Merge branch 'linux-linaro-lsk-v3.10' into linux-linaro-lsk-v3.10-android
authorKevin Hilman <khilman@linaro.org>
Fri, 14 Aug 2015 16:45:22 +0000 (09:45 -0700)
committerKevin Hilman <khilman@linaro.org>
Fri, 14 Aug 2015 16:55:00 +0000 (09:55 -0700)
 Conflicts:
fs/exec.c

 Resolution summary:

    Conflict between upstream/LTS commit 9eae8ac6ab40 (fs: take
    i_mutex during prepare_binprm for set[ug]id executables) and
    android commit 9d0ff694bc22 (sched: move no_new_privs into new
    atomic flags).  Resolution: move task_no_new_privs() usage into
    new function created by upstream/LTS comit.

202 files changed:
Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt
Documentation/devicetree/bindings/spi/spi_pl022.txt
Makefile
arch/arc/include/asm/cmpxchg.h
arch/arc/include/asm/ptrace.h
arch/arm/kvm/interrupts.S
arch/arm/kvm/interrupts_head.S
arch/arm/mach-dove/common.c
arch/arm/mach-imx/clk-imx6q.c
arch/arm/mach-kirkwood/common.c
arch/arm/mach-mv78xx0/common.c
arch/arm/mach-mvebu/armada-370-xp.c
arch/arm/mach-mvebu/coherency.c
arch/arm/mach-mvebu/coherency.h
arch/arm/mach-orion5x/common.c
arch/arm64/kernel/vdso/Makefile
arch/arm64/mm/context.c
arch/arm64/mm/init.c
arch/mips/include/asm/mach-generic/spaces.h
arch/mips/kernel/irq.c
arch/mips/kvm/kvm_mips_emul.c
arch/powerpc/perf/core-book3s.c
arch/s390/kernel/sclp.S
arch/sparc/kernel/ldc.c
arch/tile/kernel/setup.c
arch/x86/Kconfig
arch/x86/boot/compressed/head_32.S
arch/x86/include/asm/kvm_host.h
arch/x86/kernel/microcode_intel_early.c
arch/x86/kvm/i8254.c
arch/x86/kvm/lapic.c
arch/x86/kvm/svm.c
arch/x86/pci/acpi.c
block/blk-cgroup.c
block/genhd.c
drivers/acpi/acpica/acmacros.h
drivers/acpi/acpica/dsopcode.c
drivers/acpi/acpica/evregion.c
drivers/acpi/acpica/exdump.c
drivers/acpi/acpica/exfldio.c
drivers/acpi/acpica/exregion.c
drivers/acpi/acpica/hwvalid.c
drivers/acpi/acpica/nsdump.c
drivers/acpi/acpica/tbutils.c
drivers/acpi/acpica/utaddress.c
drivers/acpi/acpica/utxfinit.c
drivers/ata/libata-core.c
drivers/ata/libata-pmp.c
drivers/ata/libata-scsi.c
drivers/ata/pata_octeon_cf.c
drivers/base/firmware_class.c
drivers/base/regmap/regmap.c
drivers/block/rbd.c
drivers/bluetooth/btusb.c
drivers/bus/mvebu-mbus.c
drivers/char/agp/intel-gtt.c
drivers/char/tpm/tpm_ibmvtpm.c
drivers/cpuidle/cpuidle.c
drivers/cpuidle/governors/menu.c
drivers/crypto/caam/caamrng.c
drivers/crypto/talitos.c
drivers/dma/mv_xor.c
drivers/dma/mv_xor.h
drivers/edac/sb_edac.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/i915/intel_i2c.c
drivers/gpu/drm/mgag200/mgag200_mode.c
drivers/gpu/drm/qxl/qxl_cmd.c
drivers/gpu/drm/radeon/radeon_gart.c
drivers/gpu/drm/radeon/radeon_irq_kms.c
drivers/hwmon/mcp3021.c
drivers/i2c/busses/i2c-at91.c
drivers/iio/dac/ad5624r_spi.c
drivers/iio/imu/adis16400.h
drivers/iio/imu/adis16400_core.c
drivers/infiniband/ulp/isert/ib_isert.c
drivers/input/mouse/elantech.c
drivers/input/touchscreen/usbtouchscreen.c
drivers/md/md.c
drivers/md/persistent-data/dm-btree-remove.c
drivers/md/persistent-data/dm-btree.c
drivers/md/raid1.c
drivers/media/dvb-frontends/af9013.c
drivers/media/dvb-frontends/cx24116.c
drivers/media/dvb-frontends/s5h1420.c
drivers/mmc/card/block.c
drivers/mmc/host/sdhci-esdhc.h
drivers/mmc/host/sdhci-pxav3.c
drivers/mtd/maps/dc21285.c
drivers/mtd/mtd_blkdevs.c
drivers/net/phy/dp83640.c
drivers/net/phy/phy.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/xen-netback/xenbus.c
drivers/pcmcia/topic.h
drivers/pinctrl/mvebu/pinctrl-armada-370.c
drivers/pinctrl/mvebu/pinctrl-armada-xp.c
drivers/regulator/core.c
drivers/scsi/hpsa.c
drivers/scsi/ipr.h
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/st.c
drivers/staging/ozwpan/ozusbsvc1.c
drivers/staging/rtl8712/rtl8712_recv.c
drivers/target/iscsi/iscsi_target.c
drivers/target/iscsi/iscsi_target_core.h
drivers/target/iscsi/iscsi_target_erl0.c
drivers/target/iscsi/iscsi_target_login.c
drivers/usb/core/devio.c
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c
drivers/usb/host/xhci-hub.c
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c
drivers/usb/host/xhci.h
drivers/usb/serial/cp210x.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio_ids.h
drivers/usb/serial/option.c
drivers/usb/storage/unusual_devs.h
drivers/vhost/vhost.c
drivers/watchdog/omap_wdt.c
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/dir-item.c
fs/btrfs/extent_io.c
fs/btrfs/inode-map.c
fs/btrfs/super.c
fs/btrfs/xattr.c
fs/dcache.c
fs/exec.c
fs/ext4/indirect.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/migrate.c
fs/ext4/super.c
fs/file_table.c
fs/fuse/inode.c
fs/hpfs/super.c
fs/inode.c
fs/internal.h
fs/jbd2/checkpoint.c
fs/jbd2/journal.c
fs/nfs/nfs3xdr.c
fs/nfs/nfs4state.c
fs/open.c
fs/pipe.c
fs/super.c
fs/xfs/xfs_symlink.c
include/acpi/actypes.h
include/linux/fs.h
include/linux/jbd2.h
include/linux/libata.h
include/linux/mbus.h
include/linux/nfs_xdr.h
include/linux/sched.h
include/net/ip6_fib.h
include/uapi/linux/usbdevice_fs.h
kernel/irq/resend.c
kernel/ptrace.c
kernel/trace/ring_buffer_benchmark.c
kernel/trace/trace.h
kernel/trace/trace_branch.c
kernel/trace/trace_events_filter.c
lib/bitmap.c
mm/memory.c
mm/memory_hotplug.c
net/9p/client.c
net/bridge/br_ioctl.c
net/bridge/br_multicast.c
net/bridge/br_stp_if.c
net/ceph/osdmap.c
net/ipv4/route.c
net/ipv4/udp.c
net/ipv4/xfrm4_policy.c
net/ipv6/ip6_fib.c
net/ipv6/ndisc.c
net/ipv6/route.c
net/ipv6/udp.c
net/ipv6/xfrm6_policy.c
net/mac80211/debugfs_netdev.c
net/mac80211/main.c
net/netfilter/nfnetlink_cthelper.c
net/packet/af_packet.c
net/rds/ib_rdma.c
net/sched/sch_api.c
net/sctp/output.c
net/sunrpc/backchannel_rqst.c
net/wireless/wext-compat.c
sound/pci/hda/patch_realtek.c
sound/soc/codecs/wm8737.c
sound/soc/codecs/wm8903.h
sound/soc/codecs/wm8955.c
sound/soc/codecs/wm8960.c
sound/usb/mixer.c
sound/usb/mixer_maps.c
sound/usb/quirks-table.h

index 01ef408e205f18ce5ac3c16b44e559f01f877f08..8faff12e7014c2dfdecbe6141816ef6afcc22545 100644 (file)
@@ -91,5 +91,5 @@ mpp61         61       gpo, dev(wen1), uart1(txd), audio(rclk)
 mpp62         62       gpio, dev(a2), uart1(cts), tdm(drx), pcie(clkreq0),
                        audio(mclk), uart0(cts)
 mpp63         63       gpo, spi0(sck), tclk
-mpp64         64       gpio, spi0(miso), spi0-1(cs1)
-mpp65         65       gpio, spi0(mosi), spi0-1(cs2)
+mpp64         64       gpio, spi0(miso), spi0(cs1)
+mpp65         65       gpio, spi0(mosi), spi0(cs2)
index bfa0a2e5e0cb929d91f666537fe45a99199005d0..86dec67e54505a2e78cebfd99249772d231c51fe 100644 (file)
@@ -41,15 +41,15 @@ mpp20         20       gpio, ge0(rxd4), ge1(rxd2), lcd(d20), ptp(clk)
 mpp21         21       gpio, ge0(rxd5), ge1(rxd3), lcd(d21), mem(bat)
 mpp22         22       gpio, ge0(rxd6), ge1(rxctl), lcd(d22), sata0(prsnt)
 mpp23         23       gpio, ge0(rxd7), ge1(rxclk), lcd(d23), sata1(prsnt)
-mpp24         24       gpio, lcd(hsync), sata1(prsnt), nf(bootcs-re), tdm(rst)
-mpp25         25       gpio, lcd(vsync), sata0(prsnt), nf(bootcs-we), tdm(pclk)
-mpp26         26       gpio, lcd(clk), tdm(fsync), vdd(cpu1-pd)
+mpp24         24       gpio, lcd(hsync), sata1(prsnt), tdm(rst)
+mpp25         25       gpio, lcd(vsync), sata0(prsnt), tdm(pclk)
+mpp26         26       gpio, lcd(clk), tdm(fsync)
 mpp27         27       gpio, lcd(e), tdm(dtx), ptp(trig)
 mpp28         28       gpio, lcd(pwm), tdm(drx), ptp(evreq)
-mpp29         29       gpio, lcd(ref-clk), tdm(int0), ptp(clk), vdd(cpu0-pd)
+mpp29         29       gpio, lcd(ref-clk), tdm(int0), ptp(clk)
 mpp30         30       gpio, tdm(int1), sd0(clk)
-mpp31         31       gpio, tdm(int2), sd0(cmd), vdd(cpu0-pd)
-mpp32         32       gpio, tdm(int3), sd0(d0), vdd(cpu1-pd)
+mpp31         31       gpio, tdm(int2), sd0(cmd)
+mpp32         32       gpio, tdm(int3), sd0(d0)
 mpp33         33       gpio, tdm(int4), sd0(d1), mem(bat)
 mpp34         34       gpio, tdm(int5), sd0(d2), sata0(prsnt)
 mpp35         35       gpio, tdm(int6), sd0(d3), sata1(prsnt)
@@ -57,21 +57,18 @@ mpp36         36       gpio, spi(mosi)
 mpp37         37       gpio, spi(miso)
 mpp38         38       gpio, spi(sck)
 mpp39         39       gpio, spi(cs0)
-mpp40         40       gpio, spi(cs1), uart2(cts), lcd(vga-hsync), vdd(cpu1-pd),
-                       pcie(clkreq0)
+mpp40         40       gpio, spi(cs1), uart2(cts), lcd(vga-hsync), pcie(clkreq0)
 mpp41         41       gpio, spi(cs2), uart2(rts), lcd(vga-vsync), sata1(prsnt),
                        pcie(clkreq1)
-mpp42         42       gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer),
-                       vdd(cpu0-pd)
-mpp43         43       gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout),
-                       vdd(cpu2-3-pd){1}
+mpp42         42       gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer)
+mpp43         43       gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout)
 mpp44         44       gpio, uart2(cts), uart3(rxd), spi(cs4), pcie(clkreq2),
                        mem(bat)
 mpp45         45       gpio, uart2(rts), uart3(txd), spi(cs5), sata1(prsnt)
 mpp46         46       gpio, uart3(rts), uart1(rts), spi(cs6), sata0(prsnt)
 mpp47         47       gpio, uart3(cts), uart1(cts), spi(cs7), pcie(clkreq3),
                        ref(clkout)
-mpp48         48       gpio, tclk, dev(burst/last)
+mpp48         48       gpio, dev(clkout), dev(burst/last)
 
 * Marvell Armada XP (mv78260 and mv78460 only)
 
@@ -83,9 +80,9 @@ mpp51         51       gpio, dev(ad16)
 mpp52         52       gpio, dev(ad17)
 mpp53         53       gpio, dev(ad18)
 mpp54         54       gpio, dev(ad19)
-mpp55         55       gpio, dev(ad20), vdd(cpu0-pd)
-mpp56         56       gpio, dev(ad21), vdd(cpu1-pd)
-mpp57         57       gpio, dev(ad22), vdd(cpu2-3-pd){1}
+mpp55         55       gpio, dev(ad20)
+mpp56         56       gpio, dev(ad21)
+mpp57         57       gpio, dev(ad22)
 mpp58         58       gpio, dev(ad23)
 mpp59         59       gpio, dev(ad24)
 mpp60         60       gpio, dev(ad25)
@@ -95,6 +92,3 @@ mpp63         63       gpio, dev(ad28)
 mpp64         64       gpio, dev(ad29)
 mpp65         65       gpio, dev(ad30)
 mpp66         66       gpio, dev(ad31)
-
-Notes:
-* {1} vdd(cpu2-3-pd) only available on mv78460.
index 22ed6797216d70e3ddcf6f30e40a07d7ea559f1d..4d1673ca8cf802d4b9e13fb53538baa3d5372a48 100644 (file)
@@ -4,9 +4,9 @@ Required properties:
 - compatible : "arm,pl022", "arm,primecell"
 - reg : Offset and length of the register set for the device
 - interrupts : Should contain SPI controller interrupt
+- num-cs : total number of chipselects
 
 Optional properties:
-- num-cs : total number of chipselects
 - cs-gpios : should specify GPIOs used for chipselects.
   The gpios will be referred to as reg = <index> in the SPI child nodes.
   If unspecified, a single SPI device without a chip select can be used.
index 06743321998416963c5f992d8c7fc4d0e69c1b67..25ee724c9089465e5549006eebe9852255f36eb9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 3
 PATCHLEVEL = 10
-SUBLEVEL = 80
+SUBLEVEL = 86
 EXTRAVERSION =
 NAME = TOSSUG Baby Fish
 
index 03cd6894855d614237851515d1cafb6d2a56908b..90de5c528da221f5f5929f731962f675b6787a90 100644 (file)
@@ -25,10 +25,11 @@ __cmpxchg(volatile void *ptr, unsigned long expected, unsigned long new)
        "       scond   %3, [%1]        \n"
        "       bnz     1b              \n"
        "2:                             \n"
-       : "=&r"(prev)
-       : "r"(ptr), "ir"(expected),
-         "r"(new) /* can't be "ir". scond can't take limm for "b" */
-       : "cc");
+       : "=&r"(prev)   /* Early clobber, to prevent reg reuse */
+       : "r"(ptr),     /* Not "m": llock only supports reg direct addr mode */
+         "ir"(expected),
+         "r"(new)      /* can't be "ir". scond can't take LIMM for "b" */
+       : "cc", "memory"); /* so that gcc knows memory is being written here */
 
        return prev;
 }
index 2046a89a57cf018b481c68651232e675b58ff9f1..78485493639a4862064432e07d5440a19a72672f 100644 (file)
@@ -83,7 +83,7 @@ struct callee_regs {
        long r13;
 };
 
-#define instruction_pointer(regs)      ((regs)->ret)
+#define instruction_pointer(regs)      (unsigned long)((regs)->ret)
 #define profile_pc(regs)               instruction_pointer(regs)
 
 /* return 1 if user mode or 0 if kernel mode */
index 01dcb0e752d9f04cbb1492378cc6382397c9c8e8..d66d608f7ce7bc0a77830488eb9ce20d8d707032 100644 (file)
@@ -159,13 +159,9 @@ __kvm_vcpu_return:
        @ Don't trap coprocessor accesses for host kernel
        set_hstr vmexit
        set_hdcr vmexit
-       set_hcptr vmexit, (HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11))
+       set_hcptr vmexit, (HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11)), after_vfp_restore
 
 #ifdef CONFIG_VFPv3
-       @ Save floating point registers we if let guest use them.
-       tst     r2, #(HCPTR_TCP(10) | HCPTR_TCP(11))
-       bne     after_vfp_restore
-
        @ Switch VFP/NEON hardware state to the host's
        add     r7, vcpu, #VCPU_VFP_GUEST
        store_vfp_state r7
@@ -177,6 +173,8 @@ after_vfp_restore:
        @ Restore FPEXC_EN which we clobbered on entry
        pop     {r2}
        VFPFMXR FPEXC, r2
+#else
+after_vfp_restore:
 #endif
 
        @ Reset Hyp-role
@@ -472,7 +470,7 @@ switch_to_guest_vfp:
        push    {r3-r7}
 
        @ NEON/VFP used.  Turn on VFP access.
-       set_hcptr vmexit, (HCPTR_TCP(10) | HCPTR_TCP(11))
+       set_hcptr vmtrap, (HCPTR_TCP(10) | HCPTR_TCP(11))
 
        @ Switch VFP/NEON hardware state to the guest's
        add     r7, r0, #VCPU_VFP_HOST
index 98c8c5b9a87f392a0410a1ca51481e93172bad8f..f8f322102989200015970a2dce38ebce9d115d9b 100644 (file)
@@ -592,8 +592,13 @@ ARM_BE8(rev        r6, r6  )
 .endm
 
 /* Configures the HCPTR (Hyp Coprocessor Trap Register) on entry/return
- * (hardware reset value is 0). Keep previous value in r2. */
-.macro set_hcptr operation, mask
+ * (hardware reset value is 0). Keep previous value in r2.
+ * An ISB is emited on vmexit/vmtrap, but executed on vmexit only if
+ * VFP wasn't already enabled (always executed on vmtrap).
+ * If a label is specified with vmexit, it is branched to if VFP wasn't
+ * enabled.
+ */
+.macro set_hcptr operation, mask, label = none
        mrc     p15, 4, r2, c1, c1, 2
        ldr     r3, =\mask
        .if \operation == vmentry
@@ -602,6 +607,17 @@ ARM_BE8(rev        r6, r6  )
        bic     r3, r2, r3              @ Don't trap defined coproc-accesses
        .endif
        mcr     p15, 4, r3, c1, c1, 2
+       .if \operation != vmentry
+       .if \operation == vmexit
+       tst     r2, #(HCPTR_TCP(10) | HCPTR_TCP(11))
+       beq     1f
+       .endif
+       isb
+       .if \label != none
+       b       \label
+       .endif
+1:
+       .endif
 .endm
 
 /* Configures the HDCR (Hyp Debug Configuration Register) on entry/return
index e2b5da031f964c013478eb735a988bcb9ff12d0d..8d4f5dc569105af732fa8cb3879694918d847bde 100644 (file)
@@ -226,7 +226,7 @@ void __init dove_init_early(void)
        orion_time_set_base(TIMER_VIRT_BASE);
        mvebu_mbus_init("marvell,dove-mbus",
                        BRIDGE_WINS_BASE, BRIDGE_WINS_SZ,
-                       DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ);
+                       DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ, 0);
 }
 
 static int __init dove_find_tclk(void)
index 2acaded8025d1487b94dd22eaf30e1158d0360cf..ed00c9e3bfc65e89f13b85a1b9b0fa013ce2c65e 100644 (file)
@@ -515,7 +515,7 @@ int __init mx6q_clocks_init(void)
        clk[gpmi_io]      = imx_clk_gate2("gpmi_io",       "enfc",              base + 0x78, 28);
        clk[gpmi_apb]     = imx_clk_gate2("gpmi_apb",      "usdhc3",            base + 0x78, 30);
        clk[rom]          = imx_clk_gate2("rom",           "ahb",               base + 0x7c, 0);
-       clk[sata]         = imx_clk_gate2("sata",          "ipg",               base + 0x7c, 4);
+       clk[sata]         = imx_clk_gate2("sata",          "ahb",               base + 0x7c, 4);
        clk[sdma]         = imx_clk_gate2("sdma",          "ahb",               base + 0x7c, 6);
        clk[spba]         = imx_clk_gate2("spba",          "ipg",               base + 0x7c, 12);
        clk[ssi1_ipg]     = imx_clk_gate2("ssi1_ipg",      "ipg",               base + 0x7c, 18);
index f389228975637cd85d3f9f9444ae30e0f34537cc..4f6831ea88c549dac039f7d57542eb757cb4dd9d 100644 (file)
@@ -530,7 +530,7 @@ void __init kirkwood_init_early(void)
 
        mvebu_mbus_init("marvell,kirkwood-mbus",
                        BRIDGE_WINS_BASE, BRIDGE_WINS_SZ,
-                       DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ);
+                       DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ, 0);
 }
 
 int kirkwood_tclk;
index 749a7f8c4992e9746cccad78c0f4ee8d41553f20..4722c98dc1bb1f0495ea769d4d89aec679c84c7a 100644 (file)
@@ -337,11 +337,11 @@ void __init mv78xx0_init_early(void)
        if (mv78xx0_core_index() == 0)
                mvebu_mbus_init("marvell,mv78xx0-mbus",
                                BRIDGE_WINS_CPU0_BASE, BRIDGE_WINS_SZ,
-                               DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ);
+                               DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ, 0);
        else
                mvebu_mbus_init("marvell,mv78xx0-mbus",
                                BRIDGE_WINS_CPU1_BASE, BRIDGE_WINS_SZ,
-                               DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ);
+                               DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ, 0);
 }
 
 void __init_refok mv78xx0_timer_init(void)
index 1c48890bb72b2c7ad1301cdc9f8bad007362bf57..4377c3484a6260fe47b5a2cbda23a51f2bf0b320 100644 (file)
@@ -66,7 +66,8 @@ void __init armada_370_xp_init_early(void)
                        ARMADA_370_XP_MBUS_WINS_BASE,
                        ARMADA_370_XP_MBUS_WINS_SIZE,
                        ARMADA_370_XP_SDRAM_WINS_BASE,
-                       ARMADA_370_XP_SDRAM_WINS_SIZE);
+                       ARMADA_370_XP_SDRAM_WINS_SIZE,
+                       coherency_available());
 
 #ifdef CONFIG_CACHE_L2X0
        l2x0_of_init(0, ~0UL);
index 3ee701f1d38e1c528855eda600133735ebb5a3b9..ea26ebb5bb5ad122700be9f02085436937685da5 100644 (file)
@@ -137,6 +137,20 @@ static struct notifier_block mvebu_hwcc_platform_nb = {
        .notifier_call = mvebu_hwcc_platform_notifier,
 };
 
+/*
+ * Keep track of whether we have IO hardware coherency enabled or not.
+ * On Armada 370's we will not be using it for example. We need to make
+ * that available [through coherency_available()] so the mbus controller
+ * doesn't enable the IO coherency bit in the attribute bits of the
+ * chip selects.
+ */
+static int coherency_enabled;
+
+int coherency_available(void)
+{
+       return coherency_enabled;
+}
+
 int __init coherency_init(void)
 {
        struct device_node *np;
@@ -170,6 +184,7 @@ int __init coherency_init(void)
                coherency_base = of_iomap(np, 0);
                coherency_cpu_base = of_iomap(np, 1);
                set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
+               coherency_enabled = 1;
                bus_register_notifier(&platform_bus_type,
                                        &mvebu_hwcc_platform_nb);
        }
index 2f428137f6fedf45672146847bb95819c32a0759..1501a4e5eea0d190add8502075af3903bcc819a2 100644 (file)
@@ -19,6 +19,7 @@ int coherency_get_cpu_count(void);
 #endif
 
 int set_cpu_coherent(int cpu_id, int smp_group_id);
+int coherency_available(void);
 int coherency_init(void);
 
 #endif /* __MACH_370_XP_COHERENCY_H */
index f8a6db9239bf3c3ff7a88c29925cdce0961590cb..048773926ad4e82906e587f60a10d4b3211fbe8c 100644 (file)
@@ -213,7 +213,7 @@ void __init orion5x_init_early(void)
                mbus_soc_name = NULL;
        mvebu_mbus_init(mbus_soc_name, ORION5X_BRIDGE_WINS_BASE,
                        ORION5X_BRIDGE_WINS_SZ,
-                       ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ);
+                       ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ, 0);
 }
 
 void orion5x_setup_wins(void)
index ff3bddea482dd84ced8711376af1084f6ae594ee..f6fe17d88da55d0b212b4d6ffe900f962e1e7bd5 100644 (file)
@@ -15,6 +15,10 @@ ccflags-y := -shared -fno-common -fno-builtin
 ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
                $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
 
+# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared
+# down to collect2, resulting in silent corruption of the vDSO image.
+ccflags-y += -Wl,-shared
+
 obj-y += vdso.o
 extra-y += vdso.lds vdso-offsets.h
 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
index baa758d370210ef61f36942ab98633a80a324687..76c1e6cd36fc46d42da4c39155f02897d8462da1 100644 (file)
@@ -92,6 +92,14 @@ static void reset_context(void *info)
        unsigned int cpu = smp_processor_id();
        struct mm_struct *mm = current->active_mm;
 
+       /*
+        * current->active_mm could be init_mm for the idle thread immediately
+        * after secondary CPU boot or hotplug. TTBR0_EL1 is already set to
+        * the reserved value, so no need to reset any context.
+        */
+       if (mm == &init_mm)
+               return;
+
        smp_rmb();
        asid = cpu_last_asid + cpu;
 
index 9a9eaadb8634a6f370971d29acd1ac2bd43ec09c..23434043e093c6deba551bb1d4a3c6c540245aff 100644 (file)
@@ -297,7 +297,7 @@ static void __init free_unused_memmap(void)
                 * memmap entries are valid from the bank end aligned to
                 * MAX_ORDER_NR_PAGES.
                 */
-               prev_end = ALIGN(start + __phys_to_pfn(reg->size),
+               prev_end = ALIGN(__phys_to_pfn(reg->base + reg->size),
                                 MAX_ORDER_NR_PAGES);
        }
 
index 5b2f2e68e57f08210be7d4a98370cb3895111adf..503eb6ca5802a32aed5eca522ba333722ef436c5 100644 (file)
 #endif
 
 #ifndef FIXADDR_TOP
+#ifdef CONFIG_KVM_GUEST
+#define FIXADDR_TOP            ((unsigned long)(long)(int)0x7ffe0000)
+#else
 #define FIXADDR_TOP            ((unsigned long)(long)(int)0xfffe0000)
 #endif
+#endif
 
 #endif /* __ASM_MACH_GENERIC_SPACES_H */
index d1fea7a054be6bc3024ef3e8496e7d44f01d0cbf..7479d8d847a6f88fbb3c1b405133be936864ca8b 100644 (file)
@@ -110,7 +110,7 @@ void __init init_IRQ(void)
 #endif
 }
 
-#ifdef DEBUG_STACKOVERFLOW
+#ifdef CONFIG_DEBUG_STACKOVERFLOW
 static inline void check_stack_overflow(void)
 {
        unsigned long sp;
index e75ef8219cafb1110478487894c9369a58d60c3a..c76f297b714976897f7c2ee2d3c27f5b123e054e 100644 (file)
@@ -1626,7 +1626,7 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run)
                if (vcpu->mmio_needed == 2)
                        *gpr = *(int16_t *) run->mmio.data;
                else
-                       *gpr = *(int16_t *) run->mmio.data;
+                       *gpr = *(uint16_t *)run->mmio.data;
 
                break;
        case 1:
index 846861a20b07302bf7c0b99d4913234b31cdee49..b63dc809596d529f886591a0db4c1ca0806f0f14 100644 (file)
@@ -112,7 +112,16 @@ static inline void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) {}
 
 static bool regs_use_siar(struct pt_regs *regs)
 {
-       return !!regs->result;
+       /*
+        * When we take a performance monitor exception the regs are setup
+        * using perf_read_regs() which overloads some fields, in particular
+        * regs->result to tell us whether to use SIAR.
+        *
+        * However if the regs are from another exception, eg. a syscall, then
+        * they have not been setup using perf_read_regs() and so regs->result
+        * is something random.
+        */
+       return ((TRAP(regs) == 0xf00) && regs->result);
 }
 
 /*
index 29bd7bec41768c328c17285b4876c428727d41d0..1ecd47b5e250780cd438a968da802b6ce1305392 100644 (file)
@@ -276,6 +276,8 @@ ENTRY(_sclp_print_early)
        jno     .Lesa2
        ahi     %r15,-80
        stmh    %r6,%r15,96(%r15)               # store upper register halves
+       basr    %r13,0
+       lmh     %r0,%r15,.Lzeroes-.(%r13)       # clear upper register halves
 .Lesa2:
 #endif
        lr      %r10,%r2                        # save string pointer
@@ -299,6 +301,8 @@ ENTRY(_sclp_print_early)
 #endif
        lm      %r6,%r15,120(%r15)              # restore registers
        br      %r14
+.Lzeroes:
+       .fill   64,4,0
 
 .LwritedataS4:
        .long   0x00760005                      # SCLP command for write data
index fa4c900a0d1ff8bbd78bf000b8a8feff54f5777c..62983d77455e60a3239a178ea635868a5b4f0531 100644 (file)
@@ -2306,7 +2306,7 @@ void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len,
        if (len & (8UL - 1))
                return ERR_PTR(-EINVAL);
 
-       buf = kzalloc(len, GFP_KERNEL);
+       buf = kzalloc(len, GFP_ATOMIC);
        if (!buf)
                return ERR_PTR(-ENOMEM);
 
index 7a5aa1a7864e2371900e5ccba2d2a0f507fa834e..5ebe936762016064dc7b2a2feb90e743f23b6277 100644 (file)
@@ -1064,7 +1064,7 @@ static void __init load_hv_initrd(void)
 
 void __init free_initrd_mem(unsigned long begin, unsigned long end)
 {
-       free_bootmem(__pa(begin), end - begin);
+       free_bootmem_late(__pa(begin), end - begin);
 }
 
 #else
index b2c486f615df5e79c01bdf32f64e95e0ecabc473..252a986f69fcea7488684a2f573fe81b1313e837 100644 (file)
@@ -155,7 +155,7 @@ config SBUS
 
 config NEED_DMA_MAP_STATE
        def_bool y
-       depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG
+       depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB
 
 config NEED_SG_DMA_LENGTH
        def_bool y
index abb988a54c69337d54b62f0317d617f7dc3d108b..3b28eff9b90b76011b9025af25a5b0c9ec53f98e 100644 (file)
@@ -54,7 +54,7 @@ ENTRY(efi_pe_entry)
        call    reloc
 reloc:
        popl    %ecx
-       subl    reloc, %ecx
+       subl    $reloc, %ecx
        movl    %ecx, BP_code32_start(%eax)
 
        sub     $0x4, %esp
index b15a6b5fa3417b4b6b9b48e8a7f8f066b0ff1f73..693ab2d3920950e7206a931600bb4b261e6648f2 100644 (file)
@@ -544,7 +544,7 @@ struct kvm_arch {
        struct kvm_pic *vpic;
        struct kvm_ioapic *vioapic;
        struct kvm_pit *vpit;
-       int vapics_in_nmi_mode;
+       atomic_t vapics_in_nmi_mode;
        struct mutex apic_map_lock;
        struct kvm_apic_map *apic_map;
 
index 2e9e12871c2b51a9fe48068369f8dd4346a4db51..a883942aee44aa595b2f7bf51368aca7d99c5728 100644 (file)
@@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
        unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
        int i;
 
-       while (leftover) {
+       while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
                mc_header = (struct microcode_header_intel *)ucode_ptr;
 
                mc_size = get_totalsize(mc_header);
index 298781d4cfb44b7c6d6536d6d2779ada2eeb150a..1406ffde3e35c096fba6f9ac33c155e2a7322af1 100644 (file)
@@ -305,7 +305,7 @@ static void pit_do_work(struct kthread_work *work)
                 * LVT0 to NMI delivery. Other PIC interrupts are just sent to
                 * VCPU0, and only if its LVT0 is in EXTINT mode.
                 */
-               if (kvm->arch.vapics_in_nmi_mode > 0)
+               if (atomic_read(&kvm->arch.vapics_in_nmi_mode) > 0)
                        kvm_for_each_vcpu(i, vcpu, kvm)
                                kvm_apic_nmi_wd_deliver(vcpu);
        }
index 681e4e251f0003dcf89d25b41d892a6807121303..ff280209d7de67f85b20cfb6003202cb4e926d68 100644 (file)
@@ -1123,10 +1123,10 @@ static void apic_manage_nmi_watchdog(struct kvm_lapic *apic, u32 lvt0_val)
                if (!nmi_wd_enabled) {
                        apic_debug("Receive NMI setting on APIC_LVT0 "
                                   "for cpu %d\n", apic->vcpu->vcpu_id);
-                       apic->vcpu->kvm->arch.vapics_in_nmi_mode++;
+                       atomic_inc(&apic->vcpu->kvm->arch.vapics_in_nmi_mode);
                }
        } else if (nmi_wd_enabled)
-               apic->vcpu->kvm->arch.vapics_in_nmi_mode--;
+               atomic_dec(&apic->vcpu->kvm->arch.vapics_in_nmi_mode);
 }
 
 static int apic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
index 03f7d03c92a28f8356c81f4b9a364e0b6034e544..ee36e1e94a98aa29c22b27235485a20eac52095c 100644 (file)
@@ -495,8 +495,10 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
 {
        struct vcpu_svm *svm = to_svm(vcpu);
 
-       if (svm->vmcb->control.next_rip != 0)
+       if (svm->vmcb->control.next_rip != 0) {
+               WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS));
                svm->next_rip = svm->vmcb->control.next_rip;
+       }
 
        if (!svm->next_rip) {
                if (emulate_instruction(vcpu, EMULTYPE_SKIP) !=
@@ -4229,7 +4231,9 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu,
                break;
        }
 
-       vmcb->control.next_rip  = info->next_rip;
+       /* TODO: Advertise NRIPS to guest hypervisor unconditionally */
+       if (static_cpu_has(X86_FEATURE_NRIPS))
+               vmcb->control.next_rip  = info->next_rip;
        vmcb->control.exit_code = icpt_info.exit_code;
        vmexit = nested_svm_exit_handled(svm);
 
index 3e724256dbee6b0bb4d2e4156522a08e3bd480e4..a3b0265c2ca716dd2500093a0e97c807c65038c0 100644 (file)
@@ -84,6 +84,17 @@ static const struct dmi_system_id pci_crs_quirks[] __initconst = {
                        DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
                },
        },
+       /* https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/931368 */
+       /* https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1033299 */
+       {
+               .callback = set_use_crs,
+               .ident = "Foxconn K8M890-8237A",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "Foxconn"),
+                       DMI_MATCH(DMI_BOARD_NAME, "K8M890-8237A"),
+                       DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
+               },
+       },
 
        /* Now for the blacklist.. */
 
index 1ff8e97f853ad719ee13994f0d5fc3fafb76a775..8c4e81ac5e75432c1e29917dd6bf0305505ad7a6 100644 (file)
@@ -720,8 +720,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
                return -EINVAL;
 
        disk = get_gendisk(MKDEV(major, minor), &part);
-       if (!disk || part)
+       if (!disk)
                return -EINVAL;
+       if (part) {
+               put_disk(disk);
+               return -EINVAL;
+       }
 
        rcu_read_lock();
        spin_lock_irq(disk->queue->queue_lock);
index 2d350aae2eb66185f02bb6ac3b9bf6d741716dff..1e1244e82399d3f5617a77926e6e9474d7a9b783 100644 (file)
@@ -422,9 +422,9 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt)
        /* allocate ext devt */
        idr_preload(GFP_KERNEL);
 
-       spin_lock(&ext_devt_lock);
+       spin_lock_bh(&ext_devt_lock);
        idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_NOWAIT);
-       spin_unlock(&ext_devt_lock);
+       spin_unlock_bh(&ext_devt_lock);
 
        idr_preload_end();
        if (idx < 0)
@@ -449,9 +449,9 @@ void blk_free_devt(dev_t devt)
                return;
 
        if (MAJOR(devt) == BLOCK_EXT_MAJOR) {
-               spin_lock(&ext_devt_lock);
+               spin_lock_bh(&ext_devt_lock);
                idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt)));
-               spin_unlock(&ext_devt_lock);
+               spin_unlock_bh(&ext_devt_lock);
        }
 }
 
@@ -691,13 +691,13 @@ struct gendisk *get_gendisk(dev_t devt, int *partno)
        } else {
                struct hd_struct *part;
 
-               spin_lock(&ext_devt_lock);
+               spin_lock_bh(&ext_devt_lock);
                part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt)));
                if (part && get_disk(part_to_disk(part))) {
                        *partno = part->partno;
                        disk = part_to_disk(part);
                }
-               spin_unlock(&ext_devt_lock);
+               spin_unlock_bh(&ext_devt_lock);
        }
 
        return disk;
index 53666bd9193d5c566d264275ea7ba38518317ccc..32b0bf32364ad452f41c9723e8e2fa0b308cb8b3 100644 (file)
 #define ACPI_SET64(ptr, val)            (*ACPI_CAST64 (ptr) = (u64) (val))
 
 /*
- * printf() format helpers
+ * printf() format helper. This macros is a workaround for the difficulties
+ * with emitting 64-bit integers and 64-bit pointers with the same code
+ * for both 32-bit and 64-bit hosts.
  */
 
 /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */
 
 #define ACPI_FORMAT_UINT64(i)           ACPI_HIDWORD(i), ACPI_LODWORD(i)
 
-#if ACPI_MACHINE_WIDTH == 64
-#define ACPI_FORMAT_NATIVE_UINT(i)      ACPI_FORMAT_UINT64(i)
-#else
-#define ACPI_FORMAT_NATIVE_UINT(i)      0, (i)
-#endif
-
 /*
  * Macros for moving data around to/from buffers that are possibly unaligned.
  * If the hardware supports the transfer of unaligned data, just do the store.
index e9b13b92ba1e8d197eb9556864231ecc7d565cfd..46a37aeaedae0c1f514a06eedfac473671078f96 100644 (file)
@@ -446,7 +446,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
                          obj_desc,
-                         ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address),
+                         ACPI_FORMAT_UINT64(obj_desc->region.address),
                          obj_desc->region.length));
 
        /* Now the address and length are valid for this opregion */
@@ -544,7 +544,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
 
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
                          obj_desc,
-                         ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address),
+                         ACPI_FORMAT_UINT64(obj_desc->region.address),
                          obj_desc->region.length));
 
        /* Now the address and length are valid for this opregion */
index 8fab9262d98afc68e07c6fdf7794850b2ebd20d6..ad698893e829291bea3736ac375c779791e91e5b 100644 (file)
@@ -276,7 +276,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
        ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
                          "Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
                          &region_obj->region.handler->address_space, handler,
-                         ACPI_FORMAT_NATIVE_UINT(address),
+                         ACPI_FORMAT_UINT64(address),
                          acpi_ut_get_region_name(region_obj->region.
                                                  space_id)));
 
index e5a3c249f7fad23c544a856504d13d33134c104e..7e6a56fe1d6e0de6374dd0f1b504c0527e82fec0 100644 (file)
@@ -621,8 +621,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
                        acpi_os_printf("\n");
                } else {
                        acpi_os_printf(" base %8.8X%8.8X Length %X\n",
-                                      ACPI_FORMAT_NATIVE_UINT(obj_desc->region.
-                                                              address),
+                                      ACPI_FORMAT_UINT64(obj_desc->region.
+                                                         address),
                                       obj_desc->region.length);
                }
                break;
index c84ee956fa4c58f50c8849cc660a151d46febe39..dc210c3792778ed0b2973029ef88dfca0aeb809e 100644 (file)
@@ -269,17 +269,15 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
        }
 
        ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD,
-                             " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n",
+                             " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n",
                              acpi_ut_get_region_name(rgn_desc->region.
                                                      space_id),
                              rgn_desc->region.space_id,
                              obj_desc->common_field.access_byte_width,
                              obj_desc->common_field.base_byte_offset,
-                             field_datum_byte_offset, ACPI_CAST_PTR(void,
-                                                                    (rgn_desc->
-                                                                     region.
-                                                                     address +
-                                                                     region_offset))));
+                             field_datum_byte_offset,
+                             ACPI_FORMAT_UINT64(rgn_desc->region.address +
+                                                region_offset)));
 
        /* Invoke the appropriate address_space/op_region handler */
 
index 182abaf045e165588606bd4a52de7c98413717c1..e90c59d35a169204863c796f736117a923b7920b 100644 (file)
@@ -176,7 +176,7 @@ acpi_ex_system_memory_space_handler(u32 function,
                if (!mem_info->mapped_logical_address) {
                        ACPI_ERROR((AE_INFO,
                                    "Could not map memory at 0x%8.8X%8.8X, size %u",
-                                   ACPI_FORMAT_NATIVE_UINT(address),
+                                   ACPI_FORMAT_UINT64(address),
                                    (u32) map_length));
                        mem_info->mapped_length = 0;
                        return_ACPI_STATUS(AE_NO_MEMORY);
@@ -197,8 +197,7 @@ acpi_ex_system_memory_space_handler(u32 function,
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                          "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
-                         bit_width, function,
-                         ACPI_FORMAT_NATIVE_UINT(address)));
+                         bit_width, function, ACPI_FORMAT_UINT64(address)));
 
        /*
         * Perform the memory read or write
@@ -300,8 +299,7 @@ acpi_ex_system_io_space_handler(u32 function,
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
                          "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n",
-                         bit_width, function,
-                         ACPI_FORMAT_NATIVE_UINT(address)));
+                         bit_width, function, ACPI_FORMAT_UINT64(address)));
 
        /* Decode the function parameter */
 
index eab70d58852a674fadb1881df67fbc0ad9717aa1..fae57584a182c195b79d0e02e8f5eaba00959b91 100644 (file)
@@ -142,17 +142,17 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
        byte_width = ACPI_DIV_8(bit_width);
        last_address = address + byte_width - 1;
 
-       ACPI_DEBUG_PRINT((ACPI_DB_IO, "Address %p LastAddress %p Length %X",
-                         ACPI_CAST_PTR(void, address), ACPI_CAST_PTR(void,
-                                                                     last_address),
-                         byte_width));
+       ACPI_DEBUG_PRINT((ACPI_DB_IO,
+                         "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X",
+                         ACPI_FORMAT_UINT64(address),
+                         ACPI_FORMAT_UINT64(last_address), byte_width));
 
        /* Maximum 16-bit address in I/O space */
 
        if (last_address > ACPI_UINT16_MAX) {
                ACPI_ERROR((AE_INFO,
-                           "Illegal I/O port address/length above 64K: %p/0x%X",
-                           ACPI_CAST_PTR(void, address), byte_width));
+                           "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X",
+                           ACPI_FORMAT_UINT64(address), byte_width));
                return_ACPI_STATUS(AE_LIMIT);
        }
 
@@ -181,8 +181,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
 
                        if (acpi_gbl_osi_data >= port_info->osi_dependency) {
                                ACPI_DEBUG_PRINT((ACPI_DB_IO,
-                                                 "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)",
-                                                 ACPI_CAST_PTR(void, address),
+                                                 "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)",
+                                                 ACPI_FORMAT_UINT64(address),
                                                  byte_width, port_info->name,
                                                  port_info->start,
                                                  port_info->end));
index ce6e9732620523ba36e1a474d76dddfcf03005d9..20ae5b9bb9f2de32f4e78b6092a204ee60828ab7 100644 (file)
@@ -258,12 +258,11 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
                switch (type) {
                case ACPI_TYPE_PROCESSOR:
 
-                       acpi_os_printf("ID %02X Len %02X Addr %p\n",
+                       acpi_os_printf("ID %02X Len %02X Addr %8.8X%8.8X\n",
                                       obj_desc->processor.proc_id,
                                       obj_desc->processor.length,
-                                      ACPI_CAST_PTR(void,
-                                                    obj_desc->processor.
-                                                    address));
+                                      ACPI_FORMAT_UINT64(obj_desc->processor.
+                                                         address));
                        break;
 
                case ACPI_TYPE_DEVICE:
@@ -334,8 +333,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
                                                               space_id));
                        if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
                                acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n",
-                                              ACPI_FORMAT_NATIVE_UINT
-                                              (obj_desc->region.address),
+                                              ACPI_FORMAT_UINT64(obj_desc->
+                                                                 region.
+                                                                 address),
                                               obj_desc->region.length);
                        } else {
                                acpi_os_printf
index ce3d5db39a9c742d49fc7aa9103121942da73c6a..5c67b2840c586216d65cb44c1c4f525c6547f01f 100644 (file)
@@ -246,16 +246,12 @@ acpi_tb_print_table_header(acpi_physical_address address,
 {
        struct acpi_table_header local_header;
 
-       /*
-        * The reason that the Address is cast to a void pointer is so that we
-        * can use %p which will work properly on both 32-bit and 64-bit hosts.
-        */
        if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) {
 
                /* FACS only has signature and length fields */
 
-               ACPI_INFO((AE_INFO, "%4.4s %p %05X",
-                          header->signature, ACPI_CAST_PTR(void, address),
+               ACPI_INFO((AE_INFO, "%4.4s 0x%8.8X%8.8X %05X",
+                          header->signature, ACPI_FORMAT_UINT64(address),
                           header->length));
        } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) {
 
@@ -266,8 +262,8 @@ acpi_tb_print_table_header(acpi_physical_address address,
                                          header)->oem_id, ACPI_OEM_ID_SIZE);
                acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
 
-               ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
-                          ACPI_CAST_PTR (void, address),
+               ACPI_INFO((AE_INFO, "RSDP 0x%8.8X%8.8X %05X (v%.2d %6.6s)",
+                          ACPI_FORMAT_UINT64(address),
                           (ACPI_CAST_PTR(struct acpi_table_rsdp, header)->
                            revision >
                            0) ? ACPI_CAST_PTR(struct acpi_table_rsdp,
@@ -281,8 +277,8 @@ acpi_tb_print_table_header(acpi_physical_address address,
                acpi_tb_cleanup_table_header(&local_header, header);
 
                ACPI_INFO((AE_INFO,
-                          "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
-                          local_header.signature, ACPI_CAST_PTR(void, address),
+                          "%-4.4s 0x%8.8X%8.8X %05X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
+                          local_header.signature, ACPI_FORMAT_UINT64(address),
                           local_header.length, local_header.revision,
                           local_header.oem_id, local_header.oem_table_id,
                           local_header.oem_revision,
@@ -474,8 +470,8 @@ acpi_tb_install_table(acpi_physical_address address,
        table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
        if (!table) {
                ACPI_ERROR((AE_INFO,
-                           "Could not map memory for table [%s] at %p",
-                           signature, ACPI_CAST_PTR(void, address)));
+                           "Could not map memory for table [%s] at %8.8X%8.8X",
+                           signature, ACPI_FORMAT_UINT64(address)));
                return;
        }
 
index e0a2e2779c2ed8f8877310e07e6379e8efad0faf..3c7770d75773de9a00fb72e6538fe754145c8d14 100644 (file)
@@ -107,10 +107,10 @@ acpi_ut_add_address_range(acpi_adr_space_type space_id,
        acpi_gbl_address_range_list[space_id] = range_info;
 
        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
-                         "\nAdded [%4.4s] address range: 0x%p-0x%p\n",
+                         "\nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n",
                          acpi_ut_get_node_name(range_info->region_node),
-                         ACPI_CAST_PTR(void, address),
-                         ACPI_CAST_PTR(void, range_info->end_address)));
+                         ACPI_FORMAT_UINT64(address),
+                         ACPI_FORMAT_UINT64(range_info->end_address)));
 
        (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
        return_ACPI_STATUS(AE_OK);
@@ -160,15 +160,13 @@ acpi_ut_remove_address_range(acpi_adr_space_type space_id,
                        }
 
                        ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
-                                         "\nRemoved [%4.4s] address range: 0x%p-0x%p\n",
+                                         "\nRemoved [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n",
                                          acpi_ut_get_node_name(range_info->
                                                                region_node),
-                                         ACPI_CAST_PTR(void,
-                                                       range_info->
-                                                       start_address),
-                                         ACPI_CAST_PTR(void,
-                                                       range_info->
-                                                       end_address)));
+                                         ACPI_FORMAT_UINT64(range_info->
+                                                            start_address),
+                                         ACPI_FORMAT_UINT64(range_info->
+                                                            end_address)));
 
                        ACPI_FREE(range_info);
                        return_VOID;
@@ -244,9 +242,9 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
                                                                  region_node);
 
                                ACPI_WARNING((AE_INFO,
-                                             "0x%p-0x%p %s conflicts with Region %s %d",
-                                             ACPI_CAST_PTR(void, address),
-                                             ACPI_CAST_PTR(void, end_address),
+                                             "0x%8.8X%8.8X-0x%8.8X%8.8X %s conflicts with Region %s %d",
+                                             ACPI_FORMAT_UINT64(address),
+                                             ACPI_FORMAT_UINT64(end_address),
                                              acpi_ut_get_region_name(space_id),
                                              pathname, overlap_count));
                                ACPI_FREE(pathname);
index 41ebaaf8bb1a4e08601bf58acd9043103f8c64a5..ee58a62443bd5c0a13111f40bce5b23b0ad6b236 100644 (file)
@@ -165,10 +165,12 @@ acpi_status acpi_enable_subsystem(u32 flags)
         * Obtain a permanent mapping for the FACS. This is required for the
         * Global Lock and the Firmware Waking Vector
         */
-       status = acpi_tb_initialize_facs();
-       if (ACPI_FAILURE(status)) {
-               ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
-               return_ACPI_STATUS(status);
+       if (!(flags & ACPI_NO_FACS_INIT)) {
+               status = acpi_tb_initialize_facs();
+               if (ACPI_FAILURE(status)) {
+                       ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
+                       return_ACPI_STATUS(status);
+               }
        }
 #endif                         /* !ACPI_REDUCED_HARDWARE */
 
index 5d47a040129a545c91832bfdd82f15ce39c2eedd..53d35b6fd8bb48c53dc8fdaca66addfe73133248 100644 (file)
@@ -4150,9 +4150,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "ST3320[68]13AS",     "SD1[5-9]",     ATA_HORKAGE_NONCQ |
                                                ATA_HORKAGE_FIRMWARE_WARN },
 
-       /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */
+       /* drives which fail FPDMA_AA activation (some may freeze afterwards) */
        { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA },
        { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA },
+       { "VB0250EAVER",        "HPG7",         ATA_HORKAGE_BROKEN_FPDMA_AA },
 
        /* Blacklist entries taken from Silicon Image 3124/3132
           Windows driver .inf file - also several Linux problem reports */
@@ -4200,6 +4201,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "PIONEER DVD-RW  DVR-212D",   NULL,   ATA_HORKAGE_NOSETXFER },
        { "PIONEER DVD-RW  DVR-216D",   NULL,   ATA_HORKAGE_NOSETXFER },
 
+       /* devices that don't properly handle TRIM commands */
+       { "SuperSSpeed S238*",          NULL,   ATA_HORKAGE_NOTRIM, },
+
        /*
         * Some WD SATA-I drives spin up and down erratically when the link
         * is put into the slumber mode.  We don't have full list of the
@@ -4504,7 +4508,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
        else /* In the ancient relic department - skip all of this */
                return 0;
 
-       err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
+       /* On some disks, this command causes spin-up, so we need longer timeout */
+       err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000);
 
        DPRINTK("EXIT, err_mask=%x\n", err_mask);
        return err_mask;
index 7ccc084bf1dfb8f7b979f5e7ae777e030303d1b8..85aa76116a305eb50d77f2544c87f09914998bed 100644 (file)
@@ -460,6 +460,13 @@ static void sata_pmp_quirks(struct ata_port *ap)
                                       ATA_LFLAG_NO_SRST |
                                       ATA_LFLAG_ASSUME_ATA;
                }
+       } else if (vendor == 0x11ab && devid == 0x4140) {
+               /* Marvell 4140 quirks */
+               ata_for_each_link(link, ap, EDGE) {
+                       /* port 4 is for SEMB device and it doesn't like SRST */
+                       if (link->pmp == 4)
+                               link->flags |= ATA_LFLAG_DISABLED;
+               }
        }
 }
 
index 9933b4db7caf41cbb5c3b8b82518925b67643dd8..04e7db668362448ae717c5014254cb86d9765d07 100644 (file)
@@ -2512,7 +2512,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
                rbuf[14] = (lowest_aligned >> 8) & 0x3f;
                rbuf[15] = lowest_aligned;
 
-               if (ata_id_has_trim(args->id)) {
+               if (ata_id_has_trim(args->id) &&
+                   !(dev->horkage & ATA_HORKAGE_NOTRIM)) {
                        rbuf[14] |= 0x80; /* TPE */
 
                        if (ata_id_has_zero_after_trim(args->id))
index e73bef3093d2be6c859c462b4f8fa50758e21b80..5507f36a06b4d8cf6115c26d7e0b046e0a2e70f6 100644 (file)
@@ -1068,7 +1068,7 @@ static struct of_device_id octeon_cf_match[] = {
        },
        {},
 };
-MODULE_DEVICE_TABLE(of, octeon_i2c_match);
+MODULE_DEVICE_TABLE(of, octeon_cf_match);
 
 static struct platform_driver octeon_cf_driver = {
        .probe          = octeon_cf_probe,
index 9cf8dc7448e257446a54c0b4d904b37ae4321463..30d575a09ad17e62f345a3520f2b480519c800c2 100644 (file)
@@ -543,10 +543,8 @@ static void fw_dev_release(struct device *dev)
        module_put(THIS_MODULE);
 }
 
-static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
+static int do_firmware_uevent(struct firmware_priv *fw_priv, struct kobj_uevent_env *env)
 {
-       struct firmware_priv *fw_priv = to_firmware_priv(dev);
-
        if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->buf->fw_id))
                return -ENOMEM;
        if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout))
@@ -557,6 +555,18 @@ static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
        return 0;
 }
 
+static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+       struct firmware_priv *fw_priv = to_firmware_priv(dev);
+       int err = 0;
+
+       mutex_lock(&fw_lock);
+       if (fw_priv->buf)
+               err = do_firmware_uevent(fw_priv, env);
+       mutex_unlock(&fw_lock);
+       return err;
+}
+
 static struct class firmware_class = {
        .name           = "firmware",
        .class_attrs    = firmware_class_attrs,
index 6a66f0b7d3d46602d75d25b4fcdc5edba27682d5..4f3d70a9d7219bc38c43b8cdfa397cd107cbb0ac 100644 (file)
@@ -1586,7 +1586,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
                                          &ival);
                        if (ret != 0)
                                return ret;
-                       memcpy(val + (i * val_bytes), &ival, val_bytes);
+                       map->format.format_val(val + (i * val_bytes), ival, 0);
                }
        }
 
index dd297099c99dd1ee93980934652d7498666a4b10..f78cbbb88bd4f008adff9cfe92ad4a486ade2833 100644 (file)
@@ -1851,11 +1851,11 @@ static struct rbd_obj_request *rbd_obj_request_create(const char *object_name,
        rbd_assert(obj_request_type_valid(type));
 
        size = strlen(object_name) + 1;
-       name = kmalloc(size, GFP_KERNEL);
+       name = kmalloc(size, GFP_NOIO);
        if (!name)
                return NULL;
 
-       obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_KERNEL);
+       obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_NOIO);
        if (!obj_request) {
                kfree(name);
                return NULL;
index 92b985317770e38ab4d0e1e1a17f95faf74ee380..537ad6897784b88859e961d38f9bb7c51cce821f 100644 (file)
@@ -1234,6 +1234,8 @@ static int btusb_setup_intel(struct hci_dev *hdev)
        }
        fw_ptr = fw->data;
 
+       kfree_skb(skb);
+
        /* This Intel specific command enables the manufacturer mode of the
         * controller.
         *
index 711dcf4a0313fc059e7991e2a93bf123b98a4693..7c437826c2f994c194de622d344ada6f5dff524b 100644 (file)
@@ -838,7 +838,7 @@ fs_initcall(mvebu_mbus_debugfs_init);
 int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base,
                           size_t mbuswins_size,
                           phys_addr_t sdramwins_phys_base,
-                          size_t sdramwins_size)
+                          size_t sdramwins_size, int is_coherent)
 {
        struct mvebu_mbus_state *mbus = &mbus_state;
        const struct of_device_id *of_id;
@@ -865,8 +865,7 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base,
                return -ENOMEM;
        }
 
-       if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"))
-               mbus->hw_io_coherency = 1;
+       mbus->hw_io_coherency = is_coherent;
 
        for (win = 0; win < mbus->soc->num_wins; win++)
                mvebu_mbus_disable_window(mbus, win);
index b8e2014cb9cb0681d8fa1a21d7930b13e1e2a261..051aadb75e2cea10312442e6eb40dc965ab4a9e5 100644 (file)
@@ -583,7 +583,7 @@ static inline int needs_ilk_vtd_wa(void)
        /* Query intel_iommu to see if we need the workaround. Presumably that
         * was loaded first.
         */
-       if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB ||
+       if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG ||
             gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) &&
             intel_iommu_gfx_mapped)
                return 1;
index 09df26f9621dc3a8de6227e9c427437176cd4b5d..a6524c3efdf7cfe4781911e11e4a0799682efbfd 100644 (file)
@@ -618,6 +618,9 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
                goto cleanup;
        }
 
+       ibmvtpm->dev = dev;
+       ibmvtpm->vdev = vio_dev;
+
        crq_q = &ibmvtpm->crq_queue;
        crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL);
        if (!crq_q->crq_addr) {
@@ -662,8 +665,6 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
 
        crq_q->index = 0;
 
-       ibmvtpm->dev = dev;
-       ibmvtpm->vdev = vio_dev;
        TPM_VPRIV(chip) = (void *)ibmvtpm;
 
        spin_lock_init(&ibmvtpm->rtce_lock);
index c3a93fece819e71adb5fcae2acd84f885c0f2583..5b11022d7745669a2288dfd778601a2041e8c314 100644 (file)
@@ -135,6 +135,9 @@ int cpuidle_idle_call(void)
 
        /* ask the governor for the next state */
        next_state = cpuidle_curr_governor->select(drv, dev);
+       if (next_state < 0)
+               return -EBUSY;
+
        if (need_resched()) {
                dev->last_residency = 0;
                /* give the governor an opportunity to reflect on the outcome */
index efe23dd391ed669e5ca6f97e6801a40a9c2b3b9d..ea1787129b547a6787fb0bedea168f72ce08574f 100644 (file)
@@ -274,7 +274,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
                data->needs_update = 0;
        }
 
-       data->last_state_idx = 0;
+       data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1;
        data->exit_us = 0;
 
        /* Special case when user has set very strict latency requirement */
index d1939a9539c06a4204a26b65d3d743d46c2346d3..04aefffb4dd9b4d89659dc3ace7e67be75959486 100644 (file)
@@ -56,7 +56,7 @@
 
 /* Buffer, its dma address and lock */
 struct buf_data {
-       u8 buf[RN_BUF_SIZE];
+       u8 buf[RN_BUF_SIZE] ____cacheline_aligned;
        dma_addr_t addr;
        struct completion filled;
        u32 hw_desc[DESC_JOB_O_LEN];
index 5b2b5e61e4f9d0516e4b66090ba56ef79e941632..057d894eee667ce5fcf926e325be65af267b3870 100644 (file)
@@ -935,7 +935,8 @@ static int sg_to_link_tbl(struct scatterlist *sg, int sg_count,
                sg_count--;
                link_tbl_ptr--;
        }
-       be16_add_cpu(&link_tbl_ptr->len, cryptlen);
+       link_tbl_ptr->len = cpu_to_be16(be16_to_cpu(link_tbl_ptr->len)
+                                       + cryptlen);
 
        /* tag end of link table */
        link_tbl_ptr->j_extent = DESC_PTR_LNKTBL_RETURN;
@@ -2621,6 +2622,7 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
                break;
        default:
                dev_err(dev, "unknown algorithm type %d\n", t_alg->algt.type);
+               kfree(t_alg);
                return ERR_PTR(-EINVAL);
        }
 
index d64ae14f2706e52c5c80144ae1ea73b0607b9aad..43092c3178978cad45a1a854f241966deb905819 100644 (file)
@@ -393,7 +393,8 @@ static void __mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)
        dma_cookie_t cookie = 0;
        int busy = mv_chan_is_busy(mv_chan);
        u32 current_desc = mv_chan_get_current_desc(mv_chan);
-       int seen_current = 0;
+       int current_cleaned = 0;
+       struct mv_xor_desc *hw_desc;
 
        dev_dbg(mv_chan_to_devp(mv_chan), "%s %d\n", __func__, __LINE__);
        dev_dbg(mv_chan_to_devp(mv_chan), "current_desc %x\n", current_desc);
@@ -405,38 +406,57 @@ static void __mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)
 
        list_for_each_entry_safe(iter, _iter, &mv_chan->chain,
                                        chain_node) {
-               prefetch(_iter);
-               prefetch(&_iter->async_tx);
 
-               /* do not advance past the current descriptor loaded into the
-                * hardware channel, subsequent descriptors are either in
-                * process or have not been submitted
-                */
-               if (seen_current)
-                       break;
+               /* clean finished descriptors */
+               hw_desc = iter->hw_desc;
+               if (hw_desc->status & XOR_DESC_SUCCESS) {
+                       cookie = mv_xor_run_tx_complete_actions(iter, mv_chan,
+                                                               cookie);
 
-               /* stop the search if we reach the current descriptor and the
-                * channel is busy
-                */
-               if (iter->async_tx.phys == current_desc) {
-                       seen_current = 1;
-                       if (busy)
+                       /* done processing desc, clean slot */
+                       mv_xor_clean_slot(iter, mv_chan);
+
+                       /* break if we did cleaned the current */
+                       if (iter->async_tx.phys == current_desc) {
+                               current_cleaned = 1;
+                               break;
+                       }
+               } else {
+                       if (iter->async_tx.phys == current_desc) {
+                               current_cleaned = 0;
                                break;
+                       }
                }
-
-               cookie = mv_xor_run_tx_complete_actions(iter, mv_chan, cookie);
-
-               if (mv_xor_clean_slot(iter, mv_chan))
-                       break;
        }
 
        if ((busy == 0) && !list_empty(&mv_chan->chain)) {
-               struct mv_xor_desc_slot *chain_head;
-               chain_head = list_entry(mv_chan->chain.next,
-                                       struct mv_xor_desc_slot,
-                                       chain_node);
-
-               mv_xor_start_new_chain(mv_chan, chain_head);
+               if (current_cleaned) {
+                       /*
+                        * current descriptor cleaned and removed, run
+                        * from list head
+                        */
+                       iter = list_entry(mv_chan->chain.next,
+                                         struct mv_xor_desc_slot,
+                                         chain_node);
+                       mv_xor_start_new_chain(mv_chan, iter);
+               } else {
+                       if (!list_is_last(&iter->chain_node, &mv_chan->chain)) {
+                               /*
+                                * descriptors are still waiting after
+                                * current, trigger them
+                                */
+                               iter = list_entry(iter->chain_node.next,
+                                                 struct mv_xor_desc_slot,
+                                                 chain_node);
+                               mv_xor_start_new_chain(mv_chan, iter);
+                       } else {
+                               /*
+                                * some descriptors are still waiting
+                                * to be cleaned
+                                */
+                               tasklet_schedule(&mv_chan->irq_tasklet);
+                       }
+               }
        }
 
        if (cookie > 0)
index c632a4761fcff9836e6fbe9e59f90fa1f9080399..e003851cd4e52b93a279c6f9b04358c451d99cbc 100644 (file)
@@ -32,6 +32,7 @@
 #define XOR_OPERATION_MODE_XOR         0
 #define XOR_OPERATION_MODE_MEMCPY      2
 #define XOR_OPERATION_MODE_MEMSET      4
+#define XOR_DESC_SUCCESS               0x40000000
 
 #define XOR_CURR_DESC(chan)    (chan->mmr_base + 0x210 + (chan->idx * 4))
 #define XOR_NEXT_DESC(chan)    (chan->mmr_base + 0x200 + (chan->idx * 4))
index f505e4ca6d58efe28410f82db03cd378c5eb930e..3bdefbfb4377281380f54262a23827f14c269403 100644 (file)
@@ -623,7 +623,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
        u32 reg;
        u64 limit, prv = 0;
        u64 tmp_mb;
-       u32 mb, kb;
+       u32 gb, mb;
        u32 rir_way;
 
        /*
@@ -636,8 +636,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
        pvt->tolm = GET_TOLM(reg);
        tmp_mb = (1 + pvt->tolm) >> 20;
 
-       mb = div_u64_rem(tmp_mb, 1000, &kb);
-       edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm);
+       gb = div_u64_rem(tmp_mb, 1024, &mb);
+       edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n",
+               gb, (mb*1000)/1024, (u64)pvt->tolm);
 
        /* Address range is already 45:25 */
        pci_read_config_dword(pvt->pci_sad1, TOHM,
@@ -645,8 +646,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
        pvt->tohm = GET_TOHM(reg);
        tmp_mb = (1 + pvt->tohm) >> 20;
 
-       mb = div_u64_rem(tmp_mb, 1000, &kb);
-       edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tohm);
+       gb = div_u64_rem(tmp_mb, 1024, &mb);
+       edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n",
+               gb, (mb*1000)/1024, (u64)pvt->tohm);
 
        /*
         * Step 2) Get SAD range and SAD Interleave list
@@ -668,11 +670,11 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
                        break;
 
                tmp_mb = (limit + 1) >> 20;
-               mb = div_u64_rem(tmp_mb, 1000, &kb);
+               gb = div_u64_rem(tmp_mb, 1024, &mb);
                edac_dbg(0, "SAD#%d %s up to %u.%03u GB (0x%016Lx) Interleave: %s reg=0x%08x\n",
                         n_sads,
                         get_dram_attr(reg),
-                        mb, kb,
+                        gb, (mb*1000)/1024,
                         ((u64)tmp_mb) << 20L,
                         INTERLEAVE_MODE(reg) ? "8:6" : "[8:6]XOR[18:16]",
                         reg);
@@ -702,9 +704,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
                        break;
                tmp_mb = (limit + 1) >> 20;
 
-               mb = div_u64_rem(tmp_mb, 1000, &kb);
+               gb = div_u64_rem(tmp_mb, 1024, &mb);
                edac_dbg(0, "TAD#%d: up to %u.%03u GB (0x%016Lx), socket interleave %d, memory interleave %d, TGT: %d, %d, %d, %d, reg=0x%08x\n",
-                        n_tads, mb, kb,
+                        n_tads, gb, (mb*1000)/1024,
                         ((u64)tmp_mb) << 20L,
                         (u32)TAD_SOCK(reg),
                         (u32)TAD_CH(reg),
@@ -727,10 +729,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
                                              tad_ch_nilv_offset[j],
                                              &reg);
                        tmp_mb = TAD_OFFSET(reg) >> 20;
-                       mb = div_u64_rem(tmp_mb, 1000, &kb);
+                       gb = div_u64_rem(tmp_mb, 1024, &mb);
                        edac_dbg(0, "TAD CH#%d, offset #%d: %u.%03u GB (0x%016Lx), reg=0x%08x\n",
                                 i, j,
-                                mb, kb,
+                                gb, (mb*1000)/1024,
                                 ((u64)tmp_mb) << 20L,
                                 reg);
                }
@@ -752,10 +754,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 
                        tmp_mb = RIR_LIMIT(reg) >> 20;
                        rir_way = 1 << RIR_WAY(reg);
-                       mb = div_u64_rem(tmp_mb, 1000, &kb);
+                       gb = div_u64_rem(tmp_mb, 1024, &mb);
                        edac_dbg(0, "CH#%d RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d, reg=0x%08x\n",
                                 i, j,
-                                mb, kb,
+                                gb, (mb*1000)/1024,
                                 ((u64)tmp_mb) << 20L,
                                 rir_way,
                                 reg);
@@ -766,10 +768,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
                                                      &reg);
                                tmp_mb = RIR_OFFSET(reg) << 6;
 
-                               mb = div_u64_rem(tmp_mb, 1000, &kb);
+                               gb = div_u64_rem(tmp_mb, 1024, &mb);
                                edac_dbg(0, "CH#%d RIR#%d INTL#%d, offset %u.%03u GB (0x%016Lx), tgt: %d, reg=0x%08x\n",
                                         i, j, k,
-                                        mb, kb,
+                                        gb, (mb*1000)/1024,
                                         ((u64)tmp_mb) << 20L,
                                         (u32)RIR_RNK_TGT(reg),
                                         reg);
@@ -806,7 +808,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
        u8                      ch_way,sck_way;
        u32                     tad_offset;
        u32                     rir_way;
-       u32                     mb, kb;
+       u32                     mb, gb;
        u64                     ch_addr, offset, limit, prv = 0;
 
 
@@ -1022,10 +1024,10 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
                        continue;
 
                limit = RIR_LIMIT(reg);
-               mb = div_u64_rem(limit >> 20, 1000, &kb);
+               gb = div_u64_rem(limit >> 20, 1024, &mb);
                edac_dbg(0, "RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d\n",
                         n_rir,
-                        mb, kb,
+                        gb, (mb*1000)/1024,
                         limit,
                         1 << RIR_WAY(reg));
                if  (ch_addr <= limit)
index 8759d699bd8e1f8aafa88bf0e5682d1c2cf8a1fd..c24c356068368ebd5dc6d2aec2c01bece9c3e64a 100644 (file)
@@ -1955,8 +1955,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       /* For some reason crtc x/y offsets are signed internally. */
-       if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX)
+       /*
+        * Universal plane src offsets are only 16.16, prevent havoc for
+        * drivers using universal plane code internally.
+        */
+       if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000)
                return -ERANGE;
 
        drm_modeset_lock_all(dev);
index 4a21e13cc58c15461191bb5980ee7de68e5a7f79..d5e666fb459c5cb81f61cc08bc45cd96029984b8 100644 (file)
@@ -441,7 +441,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
                                               struct intel_gmbus,
                                               adapter);
        struct drm_i915_private *dev_priv = bus->dev_priv;
-       int i, reg_offset;
+       int i = 0, inc, try = 0, reg_offset;
        int ret = 0;
 
        mutex_lock(&dev_priv->gmbus_mutex);
@@ -453,12 +453,14 @@ gmbus_xfer(struct i2c_adapter *adapter,
 
        reg_offset = dev_priv->gpio_mmio_base;
 
+retry:
        I915_WRITE(GMBUS0 + reg_offset, bus->reg0);
 
-       for (i = 0; i < num; i++) {
+       for (; i < num; i += inc) {
+               inc = 1;
                if (gmbus_is_index_read(msgs, i, num)) {
                        ret = gmbus_xfer_index_read(dev_priv, &msgs[i]);
-                       i += 1;  /* set i to the index of the read xfer */
+                       inc = 2; /* an index read is two msgs */
                } else if (msgs[i].flags & I2C_M_RD) {
                        ret = gmbus_xfer_read(dev_priv, &msgs[i], 0);
                } else {
@@ -530,6 +532,18 @@ clear_err:
                         adapter->name, msgs[i].addr,
                         (msgs[i].flags & I2C_M_RD) ? 'r' : 'w', msgs[i].len);
 
+       /*
+        * Passive adapters sometimes NAK the first probe. Retry the first
+        * message once on -ENXIO for GMBUS transfers; the bit banging algorithm
+        * has retries internally. See also the retry loop in
+        * drm_do_probe_ddc_edid, which bails out on the first -ENXIO.
+        */
+       if (ret == -ENXIO && i == 0 && try++ == 0) {
+               DRM_DEBUG_KMS("GMBUS [%s] NAK on first message, retry\n",
+                             adapter->name);
+               goto retry;
+       }
+
        goto out;
 
 timeout:
index f6341e8622eea71bc1055dbce2f5eff3b708df2d..7bd2acce9f81fb880dd4821d92d95ec149cae397 100644 (file)
@@ -1487,6 +1487,11 @@ static int mga_vga_mode_valid(struct drm_connector *connector,
                return MODE_BANDWIDTH;
        }
 
+       if ((mode->hdisplay % 8) != 0 || (mode->hsync_start % 8) != 0 ||
+           (mode->hsync_end % 8) != 0 || (mode->htotal % 8) != 0) {
+               return MODE_H_ILLEGAL;
+       }
+
        if (mode->crtc_hdisplay > 2048 || mode->crtc_hsync_start > 4096 ||
            mode->crtc_hsync_end > 4096 || mode->crtc_htotal > 4096 ||
            mode->crtc_vdisplay > 2048 || mode->crtc_vsync_start > 4096 ||
index f86771481317b77d565675c956d77fdcb22f2789..5a48d7419baf49e0c74f3968b37d1acdc16d35d9 100644 (file)
@@ -500,6 +500,7 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev,
 
        cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release);
        cmd->type = QXL_SURFACE_CMD_CREATE;
+       cmd->flags = QXL_SURF_FLAG_KEEP_DATA;
        cmd->u.surface_create.format = surf->surf.format;
        cmd->u.surface_create.width = surf->surf.width;
        cmd->u.surface_create.height = surf->surf.height;
index 2915a1c569340fad40cc258799ec351f7d95c3f2..c4bb0bc2a1d950b72c0261e6fa69875f5699d322 100644 (file)
@@ -251,8 +251,10 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
                        }
                }
        }
-       mb();
-       radeon_gart_tlb_flush(rdev);
+       if (rdev->gart.ptr) {
+               mb();
+               radeon_gart_tlb_flush(rdev);
+       }
 }
 
 /**
@@ -294,8 +296,10 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
                        }
                }
        }
-       mb();
-       radeon_gart_tlb_flush(rdev);
+       if (rdev->gart.ptr) {
+               mb();
+               radeon_gart_tlb_flush(rdev);
+       }
        return 0;
 }
 
index 1fe12ab5c5ea9a133d7cf379f06cf37345c9349d..db83d075606eef03dd588844034f9cfc296b1602 100644 (file)
@@ -73,10 +73,12 @@ static void radeon_hotplug_work_func(struct work_struct *work)
        struct drm_mode_config *mode_config = &dev->mode_config;
        struct drm_connector *connector;
 
+       mutex_lock(&mode_config->mutex);
        if (mode_config->num_connector) {
                list_for_each_entry(connector, &mode_config->connector_list, head)
                        radeon_connector_hotplug(connector);
        }
+       mutex_unlock(&mode_config->mutex);
        /* Just fire off a uevent and let userspace tell us what to do */
        drm_helper_hpd_irq_event(dev);
 }
index eedb32292d6d3c20035f56a90820861d38e02102..f712cc785ef23bd73adf6287e65ed9b23d819784 100644 (file)
 /* output format */
 #define MCP3021_SAR_SHIFT      2
 #define MCP3021_SAR_MASK       0x3ff
-
 #define MCP3021_OUTPUT_RES     10      /* 10-bit resolution */
-#define MCP3021_OUTPUT_SCALE   4
 
 #define MCP3221_SAR_SHIFT      0
 #define MCP3221_SAR_MASK       0xfff
 #define MCP3221_OUTPUT_RES     12      /* 12-bit resolution */
-#define MCP3221_OUTPUT_SCALE   1
 
 enum chips {
        mcp3021,
@@ -54,7 +51,6 @@ struct mcp3021_data {
        u16 sar_shift;
        u16 sar_mask;
        u8 output_res;
-       u8 output_scale;
 };
 
 static int mcp3021_read16(struct i2c_client *client)
@@ -84,13 +80,7 @@ static int mcp3021_read16(struct i2c_client *client)
 
 static inline u16 volts_from_reg(struct mcp3021_data *data, u16 val)
 {
-       if (val == 0)
-               return 0;
-
-       val = val * data->output_scale - data->output_scale / 2;
-
-       return val * DIV_ROUND_CLOSEST(data->vdd,
-                       (1 << data->output_res) * data->output_scale);
+       return DIV_ROUND_CLOSEST(data->vdd * val, 1 << data->output_res);
 }
 
 static ssize_t show_in_input(struct device *dev, struct device_attribute *attr,
@@ -132,14 +122,12 @@ static int mcp3021_probe(struct i2c_client *client,
                data->sar_shift = MCP3021_SAR_SHIFT;
                data->sar_mask = MCP3021_SAR_MASK;
                data->output_res = MCP3021_OUTPUT_RES;
-               data->output_scale = MCP3021_OUTPUT_SCALE;
                break;
 
        case mcp3221:
                data->sar_shift = MCP3221_SAR_SHIFT;
                data->sar_mask = MCP3221_SAR_MASK;
                data->output_res = MCP3221_OUTPUT_RES;
-               data->output_scale = MCP3221_OUTPUT_SCALE;
                break;
        }
 
index 09324d0178d5721b8dd5aabd43a02b983c3aa492..ceabcfeb587c648cee9404c50baca87cc5ae610d 100644 (file)
@@ -63,6 +63,9 @@
 #define        AT91_TWI_UNRE           0x0080  /* Underrun Error */
 #define        AT91_TWI_NACK           0x0100  /* Not Acknowledged */
 
+#define        AT91_TWI_INT_MASK \
+       (AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY | AT91_TWI_NACK)
+
 #define        AT91_TWI_IER            0x0024  /* Interrupt Enable Register */
 #define        AT91_TWI_IDR            0x0028  /* Interrupt Disable Register */
 #define        AT91_TWI_IMR            0x002c  /* Interrupt Mask Register */
@@ -118,13 +121,12 @@ static void at91_twi_write(struct at91_twi_dev *dev, unsigned reg, unsigned val)
 
 static void at91_disable_twi_interrupts(struct at91_twi_dev *dev)
 {
-       at91_twi_write(dev, AT91_TWI_IDR,
-                      AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY);
+       at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_INT_MASK);
 }
 
 static void at91_twi_irq_save(struct at91_twi_dev *dev)
 {
-       dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & 0x7;
+       dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & AT91_TWI_INT_MASK;
        at91_disable_twi_interrupts(dev);
 }
 
@@ -214,6 +216,14 @@ static void at91_twi_write_data_dma_callback(void *data)
        dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg),
                         dev->buf_len, DMA_TO_DEVICE);
 
+       /*
+        * When this callback is called, THR/TX FIFO is likely not to be empty
+        * yet. So we have to wait for TXCOMP or NACK bits to be set into the
+        * Status Register to be sure that the STOP bit has been sent and the
+        * transfer is completed. The NACK interrupt has already been enabled,
+        * we just have to enable TXCOMP one.
+        */
+       at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP);
        at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP);
 }
 
@@ -308,7 +318,7 @@ static void at91_twi_read_data_dma_callback(void *data)
        /* The last two bytes have to be read without using dma */
        dev->buf += dev->buf_len - 2;
        dev->buf_len = 2;
-       at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_RXRDY);
+       at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_RXRDY | AT91_TWI_TXCOMP);
 }
 
 static void at91_twi_read_data_dma(struct at91_twi_dev *dev)
@@ -369,7 +379,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id)
        /* catch error flags */
        dev->transfer_status |= status;
 
-       if (irqstatus & AT91_TWI_TXCOMP) {
+       if (irqstatus & (AT91_TWI_TXCOMP | AT91_TWI_NACK)) {
                at91_disable_twi_interrupts(dev);
                complete(&dev->cmd_complete);
        }
@@ -382,6 +392,34 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
        int ret;
        bool has_unre_flag = dev->pdata->has_unre_flag;
 
+       /*
+        * WARNING: the TXCOMP bit in the Status Register is NOT a clear on
+        * read flag but shows the state of the transmission at the time the
+        * Status Register is read. According to the programmer datasheet,
+        * TXCOMP is set when both holding register and internal shifter are
+        * empty and STOP condition has been sent.
+        * Consequently, we should enable NACK interrupt rather than TXCOMP to
+        * detect transmission failure.
+        *
+        * Besides, the TXCOMP bit is already set before the i2c transaction
+        * has been started. For read transactions, this bit is cleared when
+        * writing the START bit into the Control Register. So the
+        * corresponding interrupt can safely be enabled just after.
+        * However for write transactions managed by the CPU, we first write
+        * into THR, so TXCOMP is cleared. Then we can safely enable TXCOMP
+        * interrupt. If TXCOMP interrupt were enabled before writing into THR,
+        * the interrupt handler would be called immediately and the i2c command
+        * would be reported as completed.
+        * Also when a write transaction is managed by the DMA controller,
+        * enabling the TXCOMP interrupt in this function may lead to a race
+        * condition since we don't know whether the TXCOMP interrupt is enabled
+        * before or after the DMA has started to write into THR. So the TXCOMP
+        * interrupt is enabled later by at91_twi_write_data_dma_callback().
+        * Immediately after in that DMA callback, we still need to send the
+        * STOP condition manually writing the corresponding bit into the
+        * Control Register.
+        */
+
        dev_dbg(dev->dev, "transfer: %s %d bytes.\n",
                (dev->msg->flags & I2C_M_RD) ? "read" : "write", dev->buf_len);
 
@@ -412,26 +450,24 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev)
                 * seems to be the best solution.
                 */
                if (dev->use_dma && (dev->buf_len > AT91_I2C_DMA_THRESHOLD)) {
+                       at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_NACK);
                        at91_twi_read_data_dma(dev);
-                       /*
-                        * It is important to enable TXCOMP irq here because
-                        * doing it only when transferring the last two bytes
-                        * will mask NACK errors since TXCOMP is set when a
-                        * NACK occurs.
-                        */
-                       at91_twi_write(dev, AT91_TWI_IER,
-                              AT91_TWI_TXCOMP);
-               } else
+               } else {
                        at91_twi_write(dev, AT91_TWI_IER,
-                              AT91_TWI_TXCOMP | AT91_TWI_RXRDY);
+                                      AT91_TWI_TXCOMP |
+                                      AT91_TWI_NACK |
+                                      AT91_TWI_RXRDY);
+               }
        } else {
                if (dev->use_dma && (dev->buf_len > AT91_I2C_DMA_THRESHOLD)) {
+                       at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_NACK);
                        at91_twi_write_data_dma(dev);
-                       at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP);
                } else {
                        at91_twi_write_next_byte(dev);
                        at91_twi_write(dev, AT91_TWI_IER,
-                               AT91_TWI_TXCOMP | AT91_TWI_TXRDY);
+                                      AT91_TWI_TXCOMP |
+                                      AT91_TWI_NACK |
+                                      AT91_TWI_TXRDY);
                }
        }
 
index bb298aaff321f5cc8639fcf3d710b635da37e2e5..6deac5af1cfdc5073b22d771f2dab4c2e3ad8b32 100644 (file)
@@ -22,7 +22,7 @@
 #include "ad5624r.h"
 
 static int ad5624r_spi_write(struct spi_device *spi,
-                            u8 cmd, u8 addr, u16 val, u8 len)
+                            u8 cmd, u8 addr, u16 val, u8 shift)
 {
        u32 data;
        u8 msg[3];
@@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi,
         * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits,
         * for the AD5664R, AD5644R, and AD5624R, respectively.
         */
-       data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len));
+       data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift);
        msg[0] = data >> 16;
        msg[1] = data >> 8;
        msg[2] = data;
index 0916bf6b6c311c503931f26387712c6677b17645..1e8fd2e81d45cea7cc31e1a157f06e565506a3e4 100644 (file)
@@ -165,6 +165,7 @@ struct adis16400_state {
        int                             filt_int;
 
        struct adis adis;
+       unsigned long avail_scan_mask[2];
 };
 
 /* At the moment triggers are only used for ring buffer
index 7d60c85cc16dcd9ae953dc672e737b5aaed6569f..9721c58ed847ac0dde5338a9765015c04bbb387e 100644 (file)
@@ -438,6 +438,11 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
                        *val = st->variant->temp_scale_nano / 1000000;
                        *val2 = (st->variant->temp_scale_nano % 1000000);
                        return IIO_VAL_INT_PLUS_MICRO;
+               case IIO_PRESSURE:
+                       /* 20 uBar = 0.002kPascal */
+                       *val = 0;
+                       *val2 = 2000;
+                       return IIO_VAL_INT_PLUS_MICRO;
                default:
                        return -EINVAL;
                }
@@ -480,10 +485,10 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
        }
 }
 
-#define ADIS16400_VOLTAGE_CHAN(addr, bits, name, si) { \
+#define ADIS16400_VOLTAGE_CHAN(addr, bits, name, si, chn) { \
        .type = IIO_VOLTAGE, \
        .indexed = 1, \
-       .channel = 0, \
+       .channel = chn, \
        .extend_name = name, \
        .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
                BIT(IIO_CHAN_INFO_SCALE), \
@@ -499,10 +504,10 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
 }
 
 #define ADIS16400_SUPPLY_CHAN(addr, bits) \
-       ADIS16400_VOLTAGE_CHAN(addr, bits, "supply", ADIS16400_SCAN_SUPPLY)
+       ADIS16400_VOLTAGE_CHAN(addr, bits, "supply", ADIS16400_SCAN_SUPPLY, 0)
 
 #define ADIS16400_AUX_ADC_CHAN(addr, bits) \
-       ADIS16400_VOLTAGE_CHAN(addr, bits, NULL, ADIS16400_SCAN_ADC)
+       ADIS16400_VOLTAGE_CHAN(addr, bits, NULL, ADIS16400_SCAN_ADC, 1)
 
 #define ADIS16400_GYRO_CHAN(mod, addr, bits) { \
        .type = IIO_ANGL_VEL, \
@@ -819,11 +824,6 @@ static const struct iio_info adis16400_info = {
        .debugfs_reg_access = adis_debugfs_reg_access,
 };
 
-static const unsigned long adis16400_burst_scan_mask[] = {
-       ~0UL,
-       0,
-};
-
 static const char * const adis16400_status_error_msgs[] = {
        [ADIS16400_DIAG_STAT_ZACCL_FAIL] = "Z-axis accelerometer self-test failure",
        [ADIS16400_DIAG_STAT_YACCL_FAIL] = "Y-axis accelerometer self-test failure",
@@ -871,6 +871,20 @@ static const struct adis_data adis16400_data = {
                BIT(ADIS16400_DIAG_STAT_POWER_LOW),
 };
 
+static void adis16400_setup_chan_mask(struct adis16400_state *st)
+{
+       const struct adis16400_chip_info *chip_info = st->variant;
+       unsigned i;
+
+       for (i = 0; i < chip_info->num_channels; i++) {
+               const struct iio_chan_spec *ch = &chip_info->channels[i];
+
+               if (ch->scan_index >= 0 &&
+                   ch->scan_index != ADIS16400_SCAN_TIMESTAMP)
+                       st->avail_scan_mask[0] |= BIT(ch->scan_index);
+       }
+}
+
 static int adis16400_probe(struct spi_device *spi)
 {
        struct adis16400_state *st;
@@ -894,8 +908,10 @@ static int adis16400_probe(struct spi_device *spi)
        indio_dev->info = &adis16400_info;
        indio_dev->modes = INDIO_DIRECT_MODE;
 
-       if (!(st->variant->flags & ADIS16400_NO_BURST))
-               indio_dev->available_scan_masks = adis16400_burst_scan_mask;
+       if (!(st->variant->flags & ADIS16400_NO_BURST)) {
+               adis16400_setup_chan_mask(st);
+               indio_dev->available_scan_masks = st->avail_scan_mask;
+       }
 
        ret = adis_init(&st->adis, indio_dev, spi, &adis16400_data);
        if (ret)
index 8019e642d2f51d919619ef9818a534574c4c5744..43aa807d78bd3206d16beb257f0f4438131d2e7d 100644 (file)
@@ -49,6 +49,8 @@ static int
 isert_rdma_accept(struct isert_conn *isert_conn);
 struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np);
 
+static void isert_release_work(struct work_struct *work);
+
 static void
 isert_qp_event_callback(struct ib_event *e, void *context)
 {
@@ -202,7 +204,7 @@ fail:
 static void
 isert_free_rx_descriptors(struct isert_conn *isert_conn)
 {
-       struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
+       struct ib_device *ib_dev = isert_conn->conn_device->ib_device;
        struct iser_rx_desc *rx_desc;
        int i;
 
@@ -432,6 +434,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
        init_completion(&isert_conn->conn_wait_comp_err);
        kref_init(&isert_conn->conn_kref);
        mutex_init(&isert_conn->conn_mutex);
+       INIT_WORK(&isert_conn->release_work, isert_release_work);
 
        isert_conn->conn_cm_id = cma_id;
        isert_conn->responder_resources = event->param.conn.responder_resources;
@@ -527,14 +530,15 @@ out:
 static void
 isert_connect_release(struct isert_conn *isert_conn)
 {
-       struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
        struct isert_device *device = isert_conn->conn_device;
        int cq_index;
+       struct ib_device *ib_dev = device->ib_device;
 
        pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
 
        isert_free_rx_descriptors(isert_conn);
-       rdma_destroy_id(isert_conn->conn_cm_id);
+       if (isert_conn->conn_cm_id)
+               rdma_destroy_id(isert_conn->conn_cm_id);
 
        if (isert_conn->conn_qp) {
                cq_index = ((struct isert_cq_desc *)
@@ -673,6 +677,7 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
 {
        struct isert_np *isert_np = cma_id->context;
        struct isert_conn *isert_conn;
+       bool terminating = false;
 
        if (isert_np->np_cm_id == cma_id)
                return isert_np_cma_handler(cma_id->context, event);
@@ -680,21 +685,37 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
        isert_conn = cma_id->qp->qp_context;
 
        mutex_lock(&isert_conn->conn_mutex);
+       terminating = (isert_conn->state == ISER_CONN_TERMINATING);
        isert_conn_terminate(isert_conn);
        mutex_unlock(&isert_conn->conn_mutex);
 
        pr_info("conn %p completing conn_wait\n", isert_conn);
        complete(&isert_conn->conn_wait);
 
+       if (terminating)
+               goto out;
+
+       mutex_lock(&isert_np->np_accept_mutex);
+       if (!list_empty(&isert_conn->conn_accept_node)) {
+               list_del_init(&isert_conn->conn_accept_node);
+               isert_put_conn(isert_conn);
+               queue_work(isert_release_wq, &isert_conn->release_work);
+       }
+       mutex_unlock(&isert_np->np_accept_mutex);
+
+out:
        return 0;
 }
 
-static void
+static int
 isert_connect_error(struct rdma_cm_id *cma_id)
 {
        struct isert_conn *isert_conn = cma_id->qp->qp_context;
 
+       isert_conn->conn_cm_id = NULL;
        isert_put_conn(isert_conn);
+
+       return -1;
 }
 
 static int
@@ -724,7 +745,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
        case RDMA_CM_EVENT_REJECTED:       /* FALLTHRU */
        case RDMA_CM_EVENT_UNREACHABLE:    /* FALLTHRU */
        case RDMA_CM_EVENT_CONNECT_ERROR:
-               isert_connect_error(cma_id);
+               ret = isert_connect_error(cma_id);
                break;
        default:
                pr_err("Unhandled RDMA CMA event: %d\n", event->event);
@@ -2418,7 +2439,6 @@ static void isert_wait_conn(struct iscsi_conn *conn)
 
        wait_for_completion(&isert_conn->conn_wait_comp_err);
 
-       INIT_WORK(&isert_conn->release_work, isert_release_work);
        queue_work(isert_release_wq, &isert_conn->release_work);
 }
 
index dbd4f5ad3343ef65b46f0003bdab6c9505d45c97..02099afb6c793e53386fcdada667ed9203979fcf 100644 (file)
@@ -1241,10 +1241,11 @@ static bool elantech_is_signature_valid(const unsigned char *param)
                return true;
 
        /*
-        * Some models have a revision higher then 20. Meaning param[2] may
-        * be 10 or 20, skip the rates check for these.
+        * Some hw_version >= 4 models have a revision higher then 20. Meaning
+        * that param[2] may be 10 or 20, skip the rates check for these.
         */
-       if (param[0] == 0x46 && (param[1] & 0xef) == 0x0f && param[2] < 40)
+       if ((param[0] & 0x0f) >= 0x06 && (param[1] & 0xaf) == 0x0f &&
+           param[2] < 40)
                return true;
 
        for (i = 0; i < ARRAY_SIZE(rates); i++)
index 5f87bed054674b487e724d3588806235b5b5f738..20aef5d5a24214910f7d750dec030566cd9e5934 100644 (file)
@@ -626,6 +626,9 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch)
                goto err_out;
        }
 
+       /* TSC-25 data sheet specifies a delay after the RESET command */
+       msleep(150);
+
        /* set coordinate output rate */
        buf[0] = buf[1] = 0xFF;
        ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0),
index aaf77b07bb727960557e075f17f9f4fd11485a26..631fe3e9c6e558823699477a94c4ab303c2105a4 100644 (file)
@@ -6221,7 +6221,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
            mddev->ctime         != info->ctime         ||
            mddev->level         != info->level         ||
 /*         mddev->layout        != info->layout        || */
-           !mddev->persistent   != info->not_persistent||
+           mddev->persistent    != !info->not_persistent ||
            mddev->chunk_sectors != info->chunk_size >> 9 ||
            /* ignore bottom 8 bits of state, and allow SB_BITMAP_PRESENT to change */
            ((state^info->state) & 0xfffffe00)
index b88757cd0d1d93728d27d1c1366edf0c45479daf..a03178e91a79a732f00a58a00db8ecc81dd046af 100644 (file)
@@ -309,8 +309,8 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
 
                if (s < 0 && nr_center < -s) {
                        /* not enough in central node */
-                       shift(left, center, nr_center);
-                       s = nr_center - target;
+                       shift(left, center, -nr_center);
+                       s += nr_center;
                        shift(left, right, s);
                        nr_right += s;
                } else
@@ -323,7 +323,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
                if (s > 0 && nr_center < s) {
                        /* not enough in central node */
                        shift(center, right, nr_center);
-                       s = target - nr_center;
+                       s -= nr_center;
                        shift(left, right, s);
                        nr_left -= s;
                } else
index 0a7592e88811e8aa45d9b89225bc98a459e0ee64..e3ecb0b824b55ff44423f652c34a7079c99be7e0 100644 (file)
@@ -240,7 +240,7 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root)
        int r;
        struct del_stack *s;
 
-       s = kmalloc(sizeof(*s), GFP_KERNEL);
+       s = kmalloc(sizeof(*s), GFP_NOIO);
        if (!s)
                return -ENOMEM;
        s->tm = info->tm;
index 86ac4a4ccc01a495bb21dfe5a7d91013ece7de2e..fa58438b298a586616514eaa3663f9672027ed7e 100644 (file)
@@ -327,7 +327,7 @@ static void raid1_end_read_request(struct bio *bio, int error)
                spin_lock_irqsave(&conf->device_lock, flags);
                if (r1_bio->mddev->degraded == conf->raid_disks ||
                    (r1_bio->mddev->degraded == conf->raid_disks-1 &&
-                    !test_bit(Faulty, &conf->mirrors[mirror].rdev->flags)))
+                    test_bit(In_sync, &conf->mirrors[mirror].rdev->flags)))
                        uptodate = 1;
                spin_unlock_irqrestore(&conf->device_lock, flags);
        }
index fb504f1e912500c3f8c04a9e1e0f0472255597a6..5930aee6b5d0597facf0c17b88c6859fdc01c43a 100644 (file)
@@ -606,6 +606,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
                        }
                }
 
+               /* Return an error if can't find bandwidth or the right clock */
+               if (i == ARRAY_SIZE(coeff_lut))
+                       return -EINVAL;
+
                ret = af9013_wr_regs(state, 0xae00, coeff_lut[i].val,
                        sizeof(coeff_lut[i].val));
        }
index 2916d7c74a1da16e47bd48aac1f37f78902a2e9b..7bc68b355c0b91af056a1494f6a08a6e7592d4eb 100644 (file)
@@ -963,6 +963,10 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
        struct cx24116_state *state = fe->demodulator_priv;
        int i, ret;
 
+       /* Validate length */
+       if (d->msg_len > sizeof(d->msg))
+                return -EINVAL;
+
        /* Dump DiSEqC message */
        if (debug) {
                printk(KERN_INFO "cx24116: %s(", __func__);
@@ -974,10 +978,6 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe,
                printk(") toneburst=%d\n", toneburst);
        }
 
-       /* Validate length */
-       if (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS))
-               return -EINVAL;
-
        /* DiSEqC message */
        for (i = 0; i < d->msg_len; i++)
                state->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i];
index 93eeaf7118fd0178a3dac53053f413bf4b733e3b..0b4f8fe6bf9900f8370d21bd7a12e7e336316803 100644 (file)
@@ -180,7 +180,7 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe,
        int result = 0;
 
        dprintk("enter %s\n", __func__);
-       if (cmd->msg_len > 8)
+       if (cmd->msg_len > sizeof(cmd->msg))
                return -EINVAL;
 
        /* setup for DISEQC */
index d813cb9a366676a22202934fac775f7bd6368ffb..d0dabebcaadc96079f74f3f6593123b1161a30c7 100644 (file)
@@ -201,6 +201,8 @@ static ssize_t power_ro_lock_show(struct device *dev,
 
        ret = snprintf(buf, PAGE_SIZE, "%d\n", locked);
 
+       mmc_blk_put(md);
+
        return ret;
 }
 
@@ -1839,9 +1841,11 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
                        break;
                case MMC_BLK_CMD_ERR:
                        ret = mmc_blk_cmd_err(md, card, brq, req, ret);
-                       if (!mmc_blk_reset(md, card->host, type))
-                               break;
-                       goto cmd_abort;
+                       if (mmc_blk_reset(md, card->host, type))
+                               goto cmd_abort;
+                       if (!ret)
+                               goto start_new_req;
+                       break;
                case MMC_BLK_RETRY:
                        if (retry++ < 5)
                                break;
index d25f9ab9a54da919a6e54cc05743f74ad83362f1..d33bb95224161fd052c212ba9c61b1eee6f96588 100644 (file)
@@ -40,7 +40,7 @@
 #define ESDHC_DMA_SYSCTL       0x40c
 #define ESDHC_DMA_SNOOP                0x00000040
 
-#define ESDHC_HOST_CONTROL_RES 0x05
+#define ESDHC_HOST_CONTROL_RES 0x01
 
 static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock)
 {
index 4edb24bf56f8b9801f8feb311040eb75029ac984..c24fbc574cf1235d48b02444d0df41ead6242d6f 100644 (file)
@@ -255,6 +255,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
                mmc_of_parse(host->mmc);
                sdhci_get_of_property(pdev);
                pdata = pxav3_get_mmc_pdata(dev);
+               pdev->dev.platform_data = pdata;
        } else if (pdata) {
                /* on-chip device */
                if (pdata->flags & PXA_FLAG_CARD_PERMANENT)
index f8a7dd14cee0cc7a8b6767f0ef281ea95dd89149..70a3db3ab856f47c8da32959aed6bf996f83428c 100644 (file)
@@ -38,9 +38,9 @@ static void nw_en_write(void)
         * we want to write a bit pattern XXX1 to Xilinx to enable
         * the write gate, which will be open for about the next 2ms.
         */
-       spin_lock_irqsave(&nw_gpio_lock, flags);
+       raw_spin_lock_irqsave(&nw_gpio_lock, flags);
        nw_cpld_modify(CPLD_FLASH_WR_ENABLE, CPLD_FLASH_WR_ENABLE);
-       spin_unlock_irqrestore(&nw_gpio_lock, flags);
+       raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
 
        /*
         * let the ISA bus to catch on...
index 5073cbc796d86c3a04c4f22d83b01c2f01b1d114..32d5e40c6863dcde95571fe7ac5ce3f5075e68c9 100644 (file)
@@ -199,6 +199,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
                return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/
 
        mutex_lock(&dev->lock);
+       mutex_lock(&mtd_table_mutex);
 
        if (dev->open)
                goto unlock;
@@ -222,6 +223,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
 
 unlock:
        dev->open++;
+       mutex_unlock(&mtd_table_mutex);
        mutex_unlock(&dev->lock);
        blktrans_dev_put(dev);
        return ret;
@@ -232,6 +234,7 @@ error_release:
 error_put:
        module_put(dev->tr->owner);
        kref_put(&dev->ref, blktrans_dev_release);
+       mutex_unlock(&mtd_table_mutex);
        mutex_unlock(&dev->lock);
        blktrans_dev_put(dev);
        return ret;
@@ -245,6 +248,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
                return;
 
        mutex_lock(&dev->lock);
+       mutex_lock(&mtd_table_mutex);
 
        if (--dev->open)
                goto unlock;
@@ -258,6 +262,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)
                __put_mtd_device(dev->mtd);
        }
 unlock:
+       mutex_unlock(&mtd_table_mutex);
        mutex_unlock(&dev->lock);
        blktrans_dev_put(dev);
 }
index 7490b6c866e685072f8bef2c0b63a090b4061b10..d2907a6e3dab8d142db3a34db0af63fafd8531ef 100644 (file)
@@ -45,7 +45,7 @@
 #define PSF_TX         0x1000
 #define EXT_EVENT      1
 #define CAL_EVENT      7
-#define CAL_TRIGGER    7
+#define CAL_TRIGGER    1
 #define PER_TRIGGER    6
 
 #define MII_DP83640_MICR 0x11
index dcaeb8128d8324da2c84e8a60b54714b682f7668..34ceccb50390941a39ba208b4953b341f9f8cb51 100644 (file)
@@ -1023,12 +1023,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
 
        /* According to 802.3az,the EEE is supported only in full duplex-mode.
         * Also EEE feature is active when core is operating with MII, GMII
-        * or RGMII.
+        * or RGMII (all kinds). Internal PHYs are also allowed to proceed and
+        * should return an error if they do not support EEE.
         */
        if ((phydev->duplex == DUPLEX_FULL) &&
            ((phydev->interface == PHY_INTERFACE_MODE_MII) ||
            (phydev->interface == PHY_INTERFACE_MODE_GMII) ||
-           (phydev->interface == PHY_INTERFACE_MODE_RGMII))) {
+            (phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
+             phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID))) {
                int eee_lp, eee_cap, eee_adv;
                u32 lp, cap, adv;
                int status;
index 82a1b5b16b6215d0e6ad9e522ef93b1575f16b98..c7f23d2710588f2c2f91a026d1171da6d2d074cb 100644 (file)
@@ -195,11 +195,13 @@ static bool ath_prepare_reset(struct ath_softc *sc)
        ath9k_debug_samp_bb_mac(sc);
        ath9k_hw_disable_interrupts(ah);
 
-       if (!ath_drain_all_txq(sc))
-               ret = false;
-
-       if (!ath_stoprecv(sc))
-               ret = false;
+       if (AR_SREV_9300_20_OR_LATER(ah)) {
+               ret &= ath_stoprecv(sc);
+               ret &= ath_drain_all_txq(sc);
+       } else {
+               ret &= ath_drain_all_txq(sc);
+               ret &= ath_stoprecv(sc);
+       }
 
        return ret;
 }
index 8a9e8750703f0fa47df6c3b6a9b5f717a19151ad..e0cf18c6cf118a7f76a40d69e7967db4927867d2 100644 (file)
@@ -33,6 +33,8 @@ struct backend_info {
        enum xenbus_state frontend_state;
        struct xenbus_watch hotplug_status_watch;
        u8 have_hotplug_status_watch:1;
+
+       const char *hotplug_script;
 };
 
 static int connect_rings(struct backend_info *);
@@ -55,6 +57,7 @@ static int netback_remove(struct xenbus_device *dev)
                xenvif_free(be->vif);
                be->vif = NULL;
        }
+       kfree(be->hotplug_script);
        kfree(be);
        dev_set_drvdata(&dev->dev, NULL);
        return 0;
@@ -72,6 +75,7 @@ static int netback_probe(struct xenbus_device *dev,
        struct xenbus_transaction xbt;
        int err;
        int sg;
+       const char *script;
        struct backend_info *be = kzalloc(sizeof(struct backend_info),
                                          GFP_KERNEL);
        if (!be) {
@@ -132,6 +136,15 @@ static int netback_probe(struct xenbus_device *dev,
                goto fail;
        }
 
+       script = xenbus_read(XBT_NIL, dev->nodename, "script", NULL);
+       if (IS_ERR(script)) {
+               err = PTR_ERR(script);
+               xenbus_dev_fatal(dev, err, "reading script");
+               goto fail;
+       }
+
+       be->hotplug_script = script;
+
        err = xenbus_switch_state(dev, XenbusStateInitWait);
        if (err)
                goto fail;
@@ -162,22 +175,14 @@ static int netback_uevent(struct xenbus_device *xdev,
                          struct kobj_uevent_env *env)
 {
        struct backend_info *be = dev_get_drvdata(&xdev->dev);
-       char *val;
 
-       val = xenbus_read(XBT_NIL, xdev->nodename, "script", NULL);
-       if (IS_ERR(val)) {
-               int err = PTR_ERR(val);
-               xenbus_dev_fatal(xdev, err, "reading script");
-               return err;
-       } else {
-               if (add_uevent_var(env, "script=%s", val)) {
-                       kfree(val);
-                       return -ENOMEM;
-               }
-               kfree(val);
-       }
+       if (!be)
+               return 0;
+
+       if (add_uevent_var(env, "script=%s", be->hotplug_script))
+               return -ENOMEM;
 
-       if (!be || !be->vif)
+       if (!be->vif)
                return 0;
 
        return add_uevent_var(env, "vif=%s", be->vif->dev->name);
index 615a45a8fe8674fe4d920d87884bde653f2e3b3a..582688fe75054003e9f2c0927758b162e7dd6f3a 100644 (file)
 #define TOPIC_EXCA_IF_CONTROL          0x3e    /* 8 bit */
 #define TOPIC_EXCA_IFC_33V_ENA         0x01
 
+#define TOPIC_PCI_CFG_PPBCN            0x3e    /* 16-bit */
+#define TOPIC_PCI_CFG_PPBCN_WBEN       0x0400
+
 static void topic97_zoom_video(struct pcmcia_socket *sock, int onoff)
 {
        struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
@@ -138,6 +141,7 @@ static int topic97_override(struct yenta_socket *socket)
 static int topic95_override(struct yenta_socket *socket)
 {
        u8 fctrl;
+       u16 ppbcn;
 
        /* enable 3.3V support for 16bit cards */
        fctrl = exca_readb(socket, TOPIC_EXCA_IF_CONTROL);
@@ -146,6 +150,18 @@ static int topic95_override(struct yenta_socket *socket)
        /* tell yenta to use exca registers to power 16bit cards */
        socket->flags |= YENTA_16BIT_POWER_EXCA | YENTA_16BIT_POWER_DF;
 
+       /* Disable write buffers to prevent lockups under load with numerous
+          Cardbus cards, observed on Tecra 500CDT and reported elsewhere on the
+          net.  This is not a power-on default according to the datasheet
+          but some BIOSes seem to set it. */
+       if (pci_read_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, &ppbcn) == 0
+           && socket->dev->revision <= 7
+           && (ppbcn & TOPIC_PCI_CFG_PPBCN_WBEN)) {
+               ppbcn &= ~TOPIC_PCI_CFG_PPBCN_WBEN;
+               pci_write_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, ppbcn);
+               dev_info(&socket->dev->dev, "Disabled ToPIC95 Cardbus write buffers.\n");
+       }
+
        return 0;
 }
 
index 48e21a2294830f4ad3379ae3f6973bb944e82962..c99e64ac8e0827721e39fe2b6801a09b0aa761a5 100644 (file)
@@ -358,11 +358,11 @@ static struct mvebu_mpp_mode mv88f6710_mpp_modes[] = {
        MPP_MODE(64,
           MPP_FUNCTION(0x0, "gpio", NULL),
           MPP_FUNCTION(0x1, "spi0", "miso"),
-          MPP_FUNCTION(0x2, "spi0-1", "cs1")),
+          MPP_FUNCTION(0x2, "spi0", "cs1")),
        MPP_MODE(65,
           MPP_FUNCTION(0x0, "gpio", NULL),
           MPP_FUNCTION(0x1, "spi0", "mosi"),
-          MPP_FUNCTION(0x2, "spi0-1", "cs2")),
+          MPP_FUNCTION(0x2, "spi0", "cs2")),
 };
 
 static struct mvebu_pinctrl_soc_info armada_370_pinctrl_info;
index ab5dc04b3e8a1fc961a1766461f06c67e002cb2f..5923a9ef70ccbe1680167205955e070545bb605d 100644 (file)
  * available: mv78230, mv78260 and mv78460. From a pin muxing
  * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460
  * both have 67 MPP pins (more GPIOs and address lines for the memory
- * bus mainly). The only difference between the mv78260 and the
- * mv78460 in terms of pin muxing is the addition of two functions on
- * pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two
- * cores, mv78460 has four cores).
+ * bus mainly).
  */
 
 #include <linux/err.h>
@@ -159,20 +156,17 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
        MPP_MODE(24,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "sata1", "prsnt",    V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x2, "nf", "bootcs-re",   V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x3, "tdm", "rst",        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x4, "lcd", "hsync",      V_MV78230_PLUS)),
        MPP_MODE(25,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "sata0", "prsnt",    V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x2, "nf", "bootcs-we",   V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x3, "tdm", "pclk",       V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x4, "lcd", "vsync",      V_MV78230_PLUS)),
        MPP_MODE(26,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x3, "tdm", "fsync",      V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x4, "lcd", "clk",        V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd",    V_MV78230_PLUS)),
+                MPP_VAR_FUNCTION(0x4, "lcd", "clk",        V_MV78230_PLUS)),
        MPP_MODE(27,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "ptp", "trig",       V_MV78230_PLUS),
@@ -187,8 +181,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "ptp", "clk",        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x3, "tdm", "int0",       V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk",    V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd",    V_MV78230_PLUS)),
+                MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk",    V_MV78230_PLUS)),
        MPP_MODE(30,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "sd0", "clk",        V_MV78230_PLUS),
@@ -196,13 +189,11 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
        MPP_MODE(31,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "sd0", "cmd",        V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x3, "tdm", "int2",       V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd",    V_MV78230_PLUS)),
+                MPP_VAR_FUNCTION(0x3, "tdm", "int2",       V_MV78230_PLUS)),
        MPP_MODE(32,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "sd0", "d0",         V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x3, "tdm", "int3",       V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd",    V_MV78230_PLUS)),
+                MPP_VAR_FUNCTION(0x3, "tdm", "int3",       V_MV78230_PLUS)),
        MPP_MODE(33,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "sd0", "d1",         V_MV78230_PLUS),
@@ -234,7 +225,6 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "spi", "cs1",        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x2, "uart2", "cts",      V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x3, "vdd", "cpu1-pd",    V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync",  V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0",   V_MV78230_PLUS)),
        MPP_MODE(41,
@@ -249,15 +239,13 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
                 MPP_VAR_FUNCTION(0x1, "uart2", "rxd",      V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x2, "uart0", "cts",      V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x3, "tdm", "int7",       V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x4, "tdm-1", "timer",    V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd",    V_MV78230_PLUS)),
+                MPP_VAR_FUNCTION(0x4, "tdm-1", "timer",    V_MV78230_PLUS)),
        MPP_MODE(43,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "uart2", "txd",      V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x2, "uart0", "rts",      V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x3, "spi", "cs3",        V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x4, "pcie", "rstout",    V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x5, "vdd", "cpu2-3-pd",  V_MV78460)),
+                MPP_VAR_FUNCTION(0x4, "pcie", "rstout",    V_MV78230_PLUS)),
        MPP_MODE(44,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x1, "uart2", "cts",      V_MV78230_PLUS),
@@ -286,7 +274,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
                 MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3",   V_MV78230_PLUS)),
        MPP_MODE(48,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78230_PLUS),
-                MPP_VAR_FUNCTION(0x1, "tclk", NULL,        V_MV78230_PLUS),
+                MPP_VAR_FUNCTION(0x1, "dev", "clkout",     V_MV78230_PLUS),
                 MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS)),
        MPP_MODE(49,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
@@ -308,16 +296,13 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
                 MPP_VAR_FUNCTION(0x1, "dev", "ad19",       V_MV78260_PLUS)),
        MPP_MODE(55,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
-                MPP_VAR_FUNCTION(0x1, "dev", "ad20",       V_MV78260_PLUS),
-                MPP_VAR_FUNCTION(0x2, "vdd", "cpu0-pd",    V_MV78260_PLUS)),
+                MPP_VAR_FUNCTION(0x1, "dev", "ad20",       V_MV78260_PLUS)),
        MPP_MODE(56,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
-                MPP_VAR_FUNCTION(0x1, "dev", "ad21",       V_MV78260_PLUS),
-                MPP_VAR_FUNCTION(0x2, "vdd", "cpu1-pd",    V_MV78260_PLUS)),
+                MPP_VAR_FUNCTION(0x1, "dev", "ad21",       V_MV78260_PLUS)),
        MPP_MODE(57,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
-                MPP_VAR_FUNCTION(0x1, "dev", "ad22",       V_MV78260_PLUS),
-                MPP_VAR_FUNCTION(0x2, "vdd", "cpu2-3-pd",  V_MV78460)),
+                MPP_VAR_FUNCTION(0x1, "dev", "ad22",       V_MV78260_PLUS)),
        MPP_MODE(58,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,        V_MV78260_PLUS),
                 MPP_VAR_FUNCTION(0x1, "dev", "ad23",       V_MV78260_PLUS)),
index 73cc3bba0d78dec6e309566c0f0110c449f013b0..eaaae3080802e0d382b5a5f77917e5acfe573fa6 100644 (file)
@@ -769,7 +769,7 @@ static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
 static void print_constraints(struct regulator_dev *rdev)
 {
        struct regulation_constraints *constraints = rdev->constraints;
-       char buf[80] = "";
+       char buf[160] = "";
        int count = 0;
        int ret;
 
index 62ed744bbe06c47487d5af052cfe9a9e46dbd32a..a6cdf17e27dc6ce87bcbf3b3064ce35ef8f7ac49 100644 (file)
@@ -3898,10 +3898,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
 
        /* Save the PCI command register */
        pci_read_config_word(pdev, 4, &command_register);
-       /* Turn the board off.  This is so that later pci_restore_state()
-        * won't turn the board on before the rest of config space is ready.
-        */
-       pci_disable_device(pdev);
        pci_save_state(pdev);
 
        /* find the first memory BAR, so we can find the cfg table */
@@ -3949,11 +3945,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
                goto unmap_cfgtable;
 
        pci_restore_state(pdev);
-       rc = pci_enable_device(pdev);
-       if (rc) {
-               dev_warn(&pdev->dev, "failed to enable device.\n");
-               goto unmap_cfgtable;
-       }
        pci_write_config_word(pdev, 4, command_register);
 
        /* Some devices (notably the HP Smart Array 5i Controller)
@@ -4448,6 +4439,23 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
        if (!reset_devices)
                return 0;
 
+       /* kdump kernel is loading, we don't know in which state is
+        * the pci interface. The dev->enable_cnt is equal zero
+        * so we call enable+disable, wait a while and switch it on.
+        */
+       rc = pci_enable_device(pdev);
+       if (rc) {
+               dev_warn(&pdev->dev, "Failed to enable PCI device\n");
+               return -ENODEV;
+       }
+       pci_disable_device(pdev);
+       msleep(260);                    /* a randomly chosen number */
+       rc = pci_enable_device(pdev);
+       if (rc) {
+               dev_warn(&pdev->dev, "failed to enable device.\n");
+               return -ENODEV;
+       }
+       pci_set_master(pdev);
        /* Reset the controller with a PCI power-cycle or via doorbell */
        rc = hpsa_kdump_hard_reset_controller(pdev);
 
@@ -4456,10 +4464,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
         * "performant mode".  Or, it might be 640x, which can't reset
         * due to concerns about shared bbwc between 6402/6404 pair.
         */
-       if (rc == -ENOTSUPP)
-               return rc; /* just try to do the kdump anyhow. */
-       if (rc)
-               return -ENODEV;
+       if (rc) {
+               if (rc != -ENOTSUPP) /* just try to do the kdump anyhow. */
+                       rc = -ENODEV;
+               goto out_disable;
+       }
 
        /* Now try to get the controller to respond to a no-op */
        dev_warn(&pdev->dev, "Waiting for controller to respond to no-op\n");
@@ -4470,7 +4479,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
                        dev_warn(&pdev->dev, "no-op failed%s\n",
                                        (i < 11 ? "; re-trying" : ""));
        }
-       return 0;
+
+out_disable:
+
+       pci_disable_device(pdev);
+       return rc;
 }
 
 static int hpsa_allocate_cmd_pool(struct ctlr_info *h)
@@ -4613,6 +4626,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)
                iounmap(h->transtable);
        if (h->cfgtable)
                iounmap(h->cfgtable);
+       pci_disable_device(h->pdev);
        pci_release_regions(h->pdev);
        kfree(h);
 }
index 535f57328a72d182948c3bb8b34bdb4a64c01886..c1991155403691570f047217ccdd2431057ca457 100644 (file)
 #define IPR_RUNTIME_RESET                              0x40000000
 
 #define IPR_IPL_INIT_MIN_STAGE_TIME                    5
-#define IPR_IPL_INIT_DEFAULT_STAGE_TIME                 15
+#define IPR_IPL_INIT_DEFAULT_STAGE_TIME                 30
 #define IPR_IPL_INIT_STAGE_UNKNOWN                     0x0
 #define IPR_IPL_INIT_STAGE_TRANSOP                     0xB0000000
 #define IPR_IPL_INIT_STAGE_MASK                                0xff000000
index 572579f87de4fb1c3f74268da15ff8d226384103..90861416b9e9f44063d8ce74c3a3aa3561b3fffe 100644 (file)
@@ -263,6 +263,16 @@ lpfc_sli4_eq_get(struct lpfc_queue *q)
                return NULL;
 
        q->hba_index = idx;
+
+       /*
+        * insert barrier for instruction interlock : data from the hardware
+        * must have the valid bit checked before it can be copied and acted
+        * upon. Given what was seen in lpfc_sli4_cq_get() of speculative
+        * instructions allowing action on content before valid bit checked,
+        * add barrier here as well. May not be needed as "content" is a
+        * single 32-bit entity here (vs multi word structure for cq's).
+        */
+       mb();
        return eqe;
 }
 
@@ -368,6 +378,17 @@ lpfc_sli4_cq_get(struct lpfc_queue *q)
 
        cqe = q->qe[q->hba_index].cqe;
        q->hba_index = idx;
+
+       /*
+        * insert barrier for instruction interlock : data from the hardware
+        * must have the valid bit checked before it can be copied and acted
+        * upon. Speculative instructions were allowing a bcopy at the start
+        * of lpfc_sli4_fp_handle_wcqe(), which is called immediately
+        * after our return, to copy data before the valid bit check above
+        * was done. As such, some of the copied data was stale. The barrier
+        * ensures the check is before any data is copied.
+        */
+       mb();
        return cqe;
 }
 
index d2a4c75e5b8fbc7f086877767e84c88bf49ea704..813e9d8ba351ea15fc8825dae88bcf33975c2c4d 100644 (file)
@@ -523,8 +523,9 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
        struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
        struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24;
        struct device_reg_82xx __iomem *reg82 = &ha->iobase->isp82;
-       uint32_t        rscn_entry, host_pid;
+       uint32_t        rscn_entry, host_pid, tmp_pid;
        unsigned long   flags;
+       fc_port_t       *fcport = NULL;
 
        /* Setup to process RIO completion. */
        handle_cnt = 0;
@@ -918,6 +919,20 @@ skip_rio:
                if (qla2x00_is_a_vp_did(vha, rscn_entry))
                        break;
 
+               /*
+                * Search for the rport related to this RSCN entry and mark it
+                * as lost.
+                */
+               list_for_each_entry(fcport, &vha->vp_fcports, list) {
+                       if (atomic_read(&fcport->state) != FCS_ONLINE)
+                               continue;
+                       tmp_pid = fcport->d_id.b24;
+                       if (fcport->d_id.b24 == rscn_entry) {
+                               qla2x00_mark_device_lost(vha, fcport, 0, 0);
+                               break;
+                       }
+               }
+
                atomic_set(&vha->loop_down_timer, 0);
                vha->flags.management_server_logged_in = 0;
 
index 2a32036a9404be10941a71ac0f23afe46ca449f9..fa9811200c9ddcf67bc04b33dd7dd56513eb1ea7 100644 (file)
@@ -1262,9 +1262,9 @@ static int st_open(struct inode *inode, struct file *filp)
        spin_lock(&st_use_lock);
        STp->in_use = 0;
        spin_unlock(&st_use_lock);
-       scsi_tape_put(STp);
        if (resumed)
                scsi_autopm_put_device(STp->device);
+       scsi_tape_put(STp);
        return retval;
 
 }
index 4e4b650fee3f50e9713c7ddd9649585e4104d308..d4f55b08ef78979933d1f1308383baf3913ccb53 100644 (file)
@@ -314,7 +314,11 @@ static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx,
                        struct oz_multiple_fixed *body =
                                (struct oz_multiple_fixed *)data_hdr;
                        u8 *data = body->data;
-                       int n = (len - sizeof(struct oz_multiple_fixed)+1)
+                       unsigned int n;
+                       if (!body->unit_size ||
+                               len < sizeof(struct oz_multiple_fixed) - 1)
+                               break;
+                       n = (len - (sizeof(struct oz_multiple_fixed) - 1))
                                / body->unit_size;
                        while (n--) {
                                oz_hcd_data_ind(usb_ctx->hport, body->endpoint,
@@ -376,10 +380,15 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt)
        case OZ_GET_DESC_RSP: {
                        struct oz_get_desc_rsp *body =
                                (struct oz_get_desc_rsp *)usb_hdr;
-                       int data_len = elt->length -
-                                       sizeof(struct oz_get_desc_rsp) + 1;
-                       u16 offs = le16_to_cpu(get_unaligned(&body->offset));
-                       u16 total_size =
+                       u16 offs, total_size;
+                       u8 data_len;
+
+                       if (elt->length < sizeof(struct oz_get_desc_rsp) - 1)
+                               break;
+                       data_len = elt->length -
+                                       (sizeof(struct oz_get_desc_rsp) - 1);
+                       offs = le16_to_cpu(get_unaligned(&body->offset));
+                       total_size =
                                le16_to_cpu(get_unaligned(&body->total_size));
                        oz_trace("USB_REQ_GET_DESCRIPTOR - cnf\n");
                        oz_hcd_get_desc_cnf(usb_ctx->hport, body->req_id,
index d59a74aa30489f2bf70c9f6b8a450d8ddaf4b484..4b25f3afb8dc95c5741b65fe71adce93f3fd9646 100644 (file)
@@ -1075,7 +1075,8 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
                /* for first fragment packet, driver need allocate 1536 +
                 * drvinfo_sz + RXDESC_SIZE to defrag packet. */
                if ((mf == 1) && (frag == 0))
-                       alloc_sz = 1658;/*1658+6=1664, 1664 is 128 alignment.*/
+                       /*1658+6=1664, 1664 is 128 alignment.*/
+                       alloc_sz = max_t(u16, tmp_len, 1658);
                else
                        alloc_sz = tmp_len;
                /* 2 is for IP header 4 bytes alignment in QoS packet case.
index 5a3ea20e9cb52670c150d39a25f88af4a5149107..efca110342cb051f81f903dedc66e80f4d4c2463 100644 (file)
@@ -518,7 +518,7 @@ static struct iscsit_transport iscsi_target_transport = {
 
 static int __init iscsi_target_init_module(void)
 {
-       int ret = 0;
+       int ret = 0, size;
 
        pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
 
@@ -527,6 +527,7 @@ static int __init iscsi_target_init_module(void)
                pr_err("Unable to allocate memory for iscsit_global\n");
                return -1;
        }
+       spin_lock_init(&iscsit_global->ts_bitmap_lock);
        mutex_init(&auth_id_lock);
        spin_lock_init(&sess_idr_lock);
        idr_init(&tiqn_idr);
@@ -536,15 +537,11 @@ static int __init iscsi_target_init_module(void)
        if (ret < 0)
                goto out;
 
-       ret = iscsi_thread_set_init();
-       if (ret < 0)
+       size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long);
+       iscsit_global->ts_bitmap = vzalloc(size);
+       if (!iscsit_global->ts_bitmap) {
+               pr_err("Unable to allocate iscsit_global->ts_bitmap\n");
                goto configfs_out;
-
-       if (iscsi_allocate_thread_sets(TARGET_THREAD_SET_COUNT) !=
-                       TARGET_THREAD_SET_COUNT) {
-               pr_err("iscsi_allocate_thread_sets() returned"
-                       " unexpected value!\n");
-               goto ts_out1;
        }
 
        lio_cmd_cache = kmem_cache_create("lio_cmd_cache",
@@ -553,7 +550,7 @@ static int __init iscsi_target_init_module(void)
        if (!lio_cmd_cache) {
                pr_err("Unable to kmem_cache_create() for"
                                " lio_cmd_cache\n");
-               goto ts_out2;
+               goto bitmap_out;
        }
 
        lio_qr_cache = kmem_cache_create("lio_qr_cache",
@@ -608,10 +605,8 @@ qr_out:
        kmem_cache_destroy(lio_qr_cache);
 cmd_out:
        kmem_cache_destroy(lio_cmd_cache);
-ts_out2:
-       iscsi_deallocate_thread_sets();
-ts_out1:
-       iscsi_thread_set_free();
+bitmap_out:
+       vfree(iscsit_global->ts_bitmap);
 configfs_out:
        iscsi_target_deregister_configfs();
 out:
@@ -621,8 +616,6 @@ out:
 
 static void __exit iscsi_target_cleanup_module(void)
 {
-       iscsi_deallocate_thread_sets();
-       iscsi_thread_set_free();
        iscsit_release_discovery_tpg();
        iscsit_unregister_transport(&iscsi_target_transport);
        kmem_cache_destroy(lio_cmd_cache);
@@ -633,6 +626,7 @@ static void __exit iscsi_target_cleanup_module(void)
 
        iscsi_target_deregister_configfs();
 
+       vfree(iscsit_global->ts_bitmap);
        kfree(iscsit_global);
 }
 
@@ -3590,17 +3584,16 @@ static int iscsit_send_reject(
 
 void iscsit_thread_get_cpumask(struct iscsi_conn *conn)
 {
-       struct iscsi_thread_set *ts = conn->thread_set;
        int ord, cpu;
        /*
-        * thread_id is assigned from iscsit_global->ts_bitmap from
-        * within iscsi_thread_set.c:iscsi_allocate_thread_sets()
+        * bitmap_id is assigned from iscsit_global->ts_bitmap from
+        * within iscsit_start_kthreads()
         *
-        * Here we use thread_id to determine which CPU that this
-        * iSCSI connection's iscsi_thread_set will be scheduled to
+        * Here we use bitmap_id to determine which CPU that this
+        * iSCSI connection's RX/TX threads will be scheduled to
         * execute upon.
         */
-       ord = ts->thread_id % cpumask_weight(cpu_online_mask);
+       ord = conn->bitmap_id % cpumask_weight(cpu_online_mask);
        for_each_online_cpu(cpu) {
                if (ord-- == 0) {
                        cpumask_set_cpu(cpu, conn->conn_cpumask);
@@ -3792,7 +3785,7 @@ check_rsp_state:
        switch (state) {
        case ISTATE_SEND_LOGOUTRSP:
                if (!iscsit_logout_post_handler(cmd, conn))
-                       goto restart;
+                       return -ECONNRESET;
                /* fall through */
        case ISTATE_SEND_STATUS:
        case ISTATE_SEND_ASYNCMSG:
@@ -3820,8 +3813,6 @@ check_rsp_state:
 
 err:
        return -1;
-restart:
-       return -EAGAIN;
 }
 
 static int iscsit_handle_response_queue(struct iscsi_conn *conn)
@@ -3848,21 +3839,13 @@ static int iscsit_handle_response_queue(struct iscsi_conn *conn)
 int iscsi_target_tx_thread(void *arg)
 {
        int ret = 0;
-       struct iscsi_conn *conn;
-       struct iscsi_thread_set *ts = arg;
+       struct iscsi_conn *conn = arg;
        /*
         * Allow ourselves to be interrupted by SIGINT so that a
         * connection recovery / failure event can be triggered externally.
         */
        allow_signal(SIGINT);
 
-restart:
-       conn = iscsi_tx_thread_pre_handler(ts);
-       if (!conn)
-               goto out;
-
-       ret = 0;
-
        while (!kthread_should_stop()) {
                /*
                 * Ensure that both TX and RX per connection kthreads
@@ -3871,11 +3854,9 @@ restart:
                iscsit_thread_check_cpumask(conn, current, 1);
 
                wait_event_interruptible(conn->queues_wq,
-                                        !iscsit_conn_all_queues_empty(conn) ||
-                                        ts->status == ISCSI_THREAD_SET_RESET);
+                                        !iscsit_conn_all_queues_empty(conn));
 
-               if ((ts->status == ISCSI_THREAD_SET_RESET) ||
-                    signal_pending(current))
+               if (signal_pending(current))
                        goto transport_err;
 
 get_immediate:
@@ -3886,15 +3867,14 @@ get_immediate:
                ret = iscsit_handle_response_queue(conn);
                if (ret == 1)
                        goto get_immediate;
-               else if (ret == -EAGAIN)
-                       goto restart;
+               else if (ret == -ECONNRESET)
+                       goto out;
                else if (ret < 0)
                        goto transport_err;
        }
 
 transport_err:
        iscsit_take_action_for_connection_exit(conn);
-       goto restart;
 out:
        return 0;
 }
@@ -3979,8 +3959,7 @@ int iscsi_target_rx_thread(void *arg)
        int ret;
        u8 buffer[ISCSI_HDR_LEN], opcode;
        u32 checksum = 0, digest = 0;
-       struct iscsi_conn *conn = NULL;
-       struct iscsi_thread_set *ts = arg;
+       struct iscsi_conn *conn = arg;
        struct kvec iov;
        /*
         * Allow ourselves to be interrupted by SIGINT so that a
@@ -3988,11 +3967,6 @@ int iscsi_target_rx_thread(void *arg)
         */
        allow_signal(SIGINT);
 
-restart:
-       conn = iscsi_rx_thread_pre_handler(ts);
-       if (!conn)
-               goto out;
-
        if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) {
                struct completion comp;
                int rc;
@@ -4002,7 +3976,7 @@ restart:
                if (rc < 0)
                        goto transport_err;
 
-               goto out;
+               goto transport_err;
        }
 
        while (!kthread_should_stop()) {
@@ -4085,8 +4059,6 @@ transport_err:
        if (!signal_pending(current))
                atomic_set(&conn->transport_failed, 1);
        iscsit_take_action_for_connection_exit(conn);
-       goto restart;
-out:
        return 0;
 }
 
@@ -4148,7 +4120,24 @@ int iscsit_close_connection(
        if (conn->conn_transport->transport_type == ISCSI_TCP)
                complete(&conn->conn_logout_comp);
 
-       iscsi_release_thread_set(conn);
+       if (!strcmp(current->comm, ISCSI_RX_THREAD_NAME)) {
+               if (conn->tx_thread &&
+                   cmpxchg(&conn->tx_thread_active, true, false)) {
+                       send_sig(SIGINT, conn->tx_thread, 1);
+                       kthread_stop(conn->tx_thread);
+               }
+       } else if (!strcmp(current->comm, ISCSI_TX_THREAD_NAME)) {
+               if (conn->rx_thread &&
+                   cmpxchg(&conn->rx_thread_active, true, false)) {
+                       send_sig(SIGINT, conn->rx_thread, 1);
+                       kthread_stop(conn->rx_thread);
+               }
+       }
+
+       spin_lock(&iscsit_global->ts_bitmap_lock);
+       bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
+                             get_order(1));
+       spin_unlock(&iscsit_global->ts_bitmap_lock);
 
        iscsit_stop_timers_for_cmds(conn);
        iscsit_stop_nopin_response_timer(conn);
@@ -4427,15 +4416,24 @@ static void iscsit_logout_post_handler_closesession(
        struct iscsi_conn *conn)
 {
        struct iscsi_session *sess = conn->sess;
-
-       iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
-       iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
+       int sleep = 1;
+       /*
+        * Traditional iscsi/tcp will invoke this logic from TX thread
+        * context during session logout, so clear tx_thread_active and
+        * sleep if iscsit_close_connection() has not already occured.
+        *
+        * Since iser-target invokes this logic from it's own workqueue,
+        * always sleep waiting for RX/TX thread shutdown to complete
+        * within iscsit_close_connection().
+        */
+       if (conn->conn_transport->transport_type == ISCSI_TCP)
+               sleep = cmpxchg(&conn->tx_thread_active, true, false);
 
        atomic_set(&conn->conn_logout_remove, 0);
        complete(&conn->conn_logout_comp);
 
        iscsit_dec_conn_usage_count(conn);
-       iscsit_stop_session(sess, 1, 1);
+       iscsit_stop_session(sess, sleep, sleep);
        iscsit_dec_session_usage_count(sess);
        target_put_session(sess->se_sess);
 }
@@ -4443,13 +4441,15 @@ static void iscsit_logout_post_handler_closesession(
 static void iscsit_logout_post_handler_samecid(
        struct iscsi_conn *conn)
 {
-       iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
-       iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
+       int sleep = 1;
+
+       if (conn->conn_transport->transport_type == ISCSI_TCP)
+               sleep = cmpxchg(&conn->tx_thread_active, true, false);
 
        atomic_set(&conn->conn_logout_remove, 0);
        complete(&conn->conn_logout_comp);
 
-       iscsit_cause_connection_reinstatement(conn, 1);
+       iscsit_cause_connection_reinstatement(conn, sleep);
        iscsit_dec_conn_usage_count(conn);
 }
 
@@ -4663,6 +4663,7 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force)
        struct iscsi_session *sess;
        struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
        struct se_session *se_sess, *se_sess_tmp;
+       LIST_HEAD(free_list);
        int session_count = 0;
 
        spin_lock_bh(&se_tpg->session_lock);
@@ -4684,14 +4685,17 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force)
                }
                atomic_set(&sess->session_reinstatement, 1);
                spin_unlock(&sess->conn_lock);
-               spin_unlock_bh(&se_tpg->session_lock);
 
-               iscsit_free_session(sess);
-               spin_lock_bh(&se_tpg->session_lock);
+               list_move_tail(&se_sess->sess_list, &free_list);
+       }
+       spin_unlock_bh(&se_tpg->session_lock);
 
+       list_for_each_entry_safe(se_sess, se_sess_tmp, &free_list, sess_list) {
+               sess = (struct iscsi_session *)se_sess->fabric_sess_ptr;
+
+               iscsit_free_session(sess);
                session_count++;
        }
-       spin_unlock_bh(&se_tpg->session_lock);
 
        pr_debug("Released %d iSCSI Session(s) from Target Portal"
                        " Group: %hu\n", session_count, tpg->tpgt);
index e117870eb445ffe2521997a16ff89e541c599fb7..815bf5b1a4ae43aee0af2bbcbf47d1c2a5fbda20 100644 (file)
@@ -586,6 +586,11 @@ struct iscsi_conn {
        struct iscsi_session    *sess;
        /* Pointer to thread_set in use for this conn's threads */
        struct iscsi_thread_set *thread_set;
+       int                     bitmap_id;
+       int                     rx_thread_active;
+       struct task_struct      *rx_thread;
+       int                     tx_thread_active;
+       struct task_struct      *tx_thread;
        /* list_head for session connection list */
        struct list_head        conn_list;
 } ____cacheline_aligned;
@@ -862,10 +867,12 @@ struct iscsit_global {
        /* Unique identifier used for the authentication daemon */
        u32                     auth_id;
        u32                     inactive_ts;
+#define ISCSIT_BITMAP_BITS     262144
        /* Thread Set bitmap count */
        int                     ts_bitmap_count;
        /* Thread Set bitmap pointer */
        unsigned long           *ts_bitmap;
+       spinlock_t              ts_bitmap_lock;
        /* Used for iSCSI discovery session authentication */
        struct iscsi_node_acl   discovery_acl;
        struct iscsi_portal_group       *discovery_tpg;
index 08bd87833321c09b14938c210b14e76d2f24a618..fab67eea54c0dd33b93a381b58ab76306b905bcf 100644 (file)
@@ -866,7 +866,10 @@ void iscsit_connection_reinstatement_rcfr(struct iscsi_conn *conn)
        }
        spin_unlock_bh(&conn->state_lock);
 
-       iscsi_thread_set_force_reinstatement(conn);
+       if (conn->tx_thread && conn->tx_thread_active)
+               send_sig(SIGINT, conn->tx_thread, 1);
+       if (conn->rx_thread && conn->rx_thread_active)
+               send_sig(SIGINT, conn->rx_thread, 1);
 
 sleep:
        wait_for_completion(&conn->conn_wait_rcfr_comp);
@@ -891,10 +894,10 @@ void iscsit_cause_connection_reinstatement(struct iscsi_conn *conn, int sleep)
                return;
        }
 
-       if (iscsi_thread_set_force_reinstatement(conn) < 0) {
-               spin_unlock_bh(&conn->state_lock);
-               return;
-       }
+       if (conn->tx_thread && conn->tx_thread_active)
+               send_sig(SIGINT, conn->tx_thread, 1);
+       if (conn->rx_thread && conn->rx_thread_active)
+               send_sig(SIGINT, conn->rx_thread, 1);
 
        atomic_set(&conn->connection_reinstatement, 1);
        if (!sleep) {
index 0493e8b1ba8fdd813ef28f23523b26dd3af2f6b2..797b2e2acc356eba2cbb6f69b706d6e581a78b8d 100644 (file)
@@ -683,7 +683,52 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn)
                iscsit_start_nopin_timer(conn);
 }
 
-static int iscsi_post_login_handler(
+int iscsit_start_kthreads(struct iscsi_conn *conn)
+{
+       int ret = 0;
+
+       spin_lock(&iscsit_global->ts_bitmap_lock);
+       conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap,
+                                       ISCSIT_BITMAP_BITS, get_order(1));
+       spin_unlock(&iscsit_global->ts_bitmap_lock);
+
+       if (conn->bitmap_id < 0) {
+               pr_err("bitmap_find_free_region() failed for"
+                      " iscsit_start_kthreads()\n");
+               return -ENOMEM;
+       }
+
+       conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn,
+                                     "%s", ISCSI_TX_THREAD_NAME);
+       if (IS_ERR(conn->tx_thread)) {
+               pr_err("Unable to start iscsi_target_tx_thread\n");
+               ret = PTR_ERR(conn->tx_thread);
+               goto out_bitmap;
+       }
+       conn->tx_thread_active = true;
+
+       conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
+                                     "%s", ISCSI_RX_THREAD_NAME);
+       if (IS_ERR(conn->rx_thread)) {
+               pr_err("Unable to start iscsi_target_rx_thread\n");
+               ret = PTR_ERR(conn->rx_thread);
+               goto out_tx;
+       }
+       conn->rx_thread_active = true;
+
+       return 0;
+out_tx:
+       kthread_stop(conn->tx_thread);
+       conn->tx_thread_active = false;
+out_bitmap:
+       spin_lock(&iscsit_global->ts_bitmap_lock);
+       bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
+                             get_order(1));
+       spin_unlock(&iscsit_global->ts_bitmap_lock);
+       return ret;
+}
+
+int iscsi_post_login_handler(
        struct iscsi_np *np,
        struct iscsi_conn *conn,
        u8 zero_tsih)
@@ -693,7 +738,7 @@ static int iscsi_post_login_handler(
        struct se_session *se_sess = sess->se_sess;
        struct iscsi_portal_group *tpg = ISCSI_TPG_S(sess);
        struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
-       struct iscsi_thread_set *ts;
+       int rc;
 
        iscsit_inc_conn_usage_count(conn);
 
@@ -708,7 +753,6 @@ static int iscsi_post_login_handler(
        /*
         * SCSI Initiator -> SCSI Target Port Mapping
         */
-       ts = iscsi_get_thread_set();
        if (!zero_tsih) {
                iscsi_set_session_parameters(sess->sess_ops,
                                conn->param_list, 0);
@@ -735,9 +779,11 @@ static int iscsi_post_login_handler(
                        sess->sess_ops->InitiatorName);
                spin_unlock_bh(&sess->conn_lock);
 
-               iscsi_post_login_start_timers(conn);
+               rc = iscsit_start_kthreads(conn);
+               if (rc)
+                       return rc;
 
-               iscsi_activate_thread_set(conn, ts);
+               iscsi_post_login_start_timers(conn);
                /*
                 * Determine CPU mask to ensure connection's RX and TX kthreads
                 * are scheduled on the same CPU.
@@ -794,8 +840,11 @@ static int iscsi_post_login_handler(
                " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt);
        spin_unlock_bh(&se_tpg->session_lock);
 
+       rc = iscsit_start_kthreads(conn);
+       if (rc)
+               return rc;
+
        iscsi_post_login_start_timers(conn);
-       iscsi_activate_thread_set(conn, ts);
        /*
         * Determine CPU mask to ensure connection's RX and TX kthreads
         * are scheduled on the same CPU.
index 78ddfb43750a69a22a4f2b0ad8b42fa744ff5263..62e532fb82ad4a4230094becb2fa676a1a9b9d78 100644 (file)
@@ -513,7 +513,7 @@ static void async_completed(struct urb *urb)
        snoop(&urb->dev->dev, "urb complete\n");
        snoop_urb(urb->dev, as->userurb, urb->pipe, urb->actual_length,
                        as->status, COMPLETE, NULL, 0);
-       if ((urb->transfer_flags & URB_DIR_MASK) == USB_DIR_IN)
+       if ((urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN)
                snoop_urb_data(urb, urb->actual_length);
 
        if (as->status < 0 && as->bulk_addr && as->status != -ECONNRESET &&
@@ -1593,7 +1593,7 @@ static struct async *reap_as(struct dev_state *ps)
        for (;;) {
                __set_current_state(TASK_INTERRUPTIBLE);
                as = async_getcompleted(ps);
-               if (as)
+               if (as || !connected(ps))
                        break;
                if (signal_pending(current))
                        break;
@@ -1616,7 +1616,7 @@ static int proc_reapurb(struct dev_state *ps, void __user *arg)
        }
        if (signal_pending(current))
                return -EINTR;
-       return -EIO;
+       return -ENODEV;
 }
 
 static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg)
@@ -1625,10 +1625,11 @@ static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg)
        struct async *as;
 
        as = async_getcompleted(ps);
-       retval = -EAGAIN;
        if (as) {
                retval = processcompl(as, (void __user * __user *)arg);
                free_async(as);
+       } else {
+               retval = (connected(ps) ? -EAGAIN : -ENODEV);
        }
        return retval;
 }
@@ -1758,7 +1759,7 @@ static int proc_reapurb_compat(struct dev_state *ps, void __user *arg)
        }
        if (signal_pending(current))
                return -EINTR;
-       return -EIO;
+       return -ENODEV;
 }
 
 static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
@@ -1766,11 +1767,12 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)
        int retval;
        struct async *as;
 
-       retval = -EAGAIN;
        as = async_getcompleted(ps);
        if (as) {
                retval = processcompl_compat(as, (void __user * __user *)arg);
                free_async(as);
+       } else {
+               retval = (connected(ps) ? -EAGAIN : -ENODEV);
        }
        return retval;
 }
@@ -1941,7 +1943,8 @@ static int proc_get_capabilities(struct dev_state *ps, void __user *arg)
 {
        __u32 caps;
 
-       caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM;
+       caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM |
+                       USBDEVFS_CAP_REAP_AFTER_DISCONNECT;
        if (!ps->dev->bus->no_stop_on_short)
                caps |= USBDEVFS_CAP_BULK_CONTINUATION;
        if (ps->dev->bus->sg_tablesize)
@@ -2002,6 +2005,32 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                return -EPERM;
 
        usb_lock_device(dev);
+
+       /* Reap operations are allowed even after disconnection */
+       switch (cmd) {
+       case USBDEVFS_REAPURB:
+               snoop(&dev->dev, "%s: REAPURB\n", __func__);
+               ret = proc_reapurb(ps, p);
+               goto done;
+
+       case USBDEVFS_REAPURBNDELAY:
+               snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__);
+               ret = proc_reapurbnonblock(ps, p);
+               goto done;
+
+#ifdef CONFIG_COMPAT
+       case USBDEVFS_REAPURB32:
+               snoop(&dev->dev, "%s: REAPURB32\n", __func__);
+               ret = proc_reapurb_compat(ps, p);
+               goto done;
+
+       case USBDEVFS_REAPURBNDELAY32:
+               snoop(&dev->dev, "%s: REAPURBNDELAY32\n", __func__);
+               ret = proc_reapurbnonblock_compat(ps, p);
+               goto done;
+#endif
+       }
+
        if (!connected(ps)) {
                usb_unlock_device(dev);
                return -ENODEV;
@@ -2095,16 +2124,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                        inode->i_mtime = CURRENT_TIME;
                break;
 
-       case USBDEVFS_REAPURB32:
-               snoop(&dev->dev, "%s: REAPURB32\n", __func__);
-               ret = proc_reapurb_compat(ps, p);
-               break;
-
-       case USBDEVFS_REAPURBNDELAY32:
-               snoop(&dev->dev, "%s: REAPURBNDELAY32\n", __func__);
-               ret = proc_reapurbnonblock_compat(ps, p);
-               break;
-
        case USBDEVFS_IOCTL32:
                snoop(&dev->dev, "%s: IOCTL32\n", __func__);
                ret = proc_ioctl_compat(ps, ptr_to_compat(p));
@@ -2116,16 +2135,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                ret = proc_unlinkurb(ps, p);
                break;
 
-       case USBDEVFS_REAPURB:
-               snoop(&dev->dev, "%s: REAPURB\n", __func__);
-               ret = proc_reapurb(ps, p);
-               break;
-
-       case USBDEVFS_REAPURBNDELAY:
-               snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__);
-               ret = proc_reapurbnonblock(ps, p);
-               break;
-
        case USBDEVFS_DISCSIGNAL:
                snoop(&dev->dev, "%s: DISCSIGNAL\n", __func__);
                ret = proc_disconnectsignal(ps, p);
@@ -2162,6 +2171,8 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
                ret = proc_disconnect_claim(ps, p);
                break;
        }
+
+ done:
        usb_unlock_device(dev);
        if (ret >= 0)
                inode->i_atime = CURRENT_TIME;
index 6cd418f6ac071a12305232673ba335e57598dfcc..57d7ec6c8090e88d596b5b1bdfe4d49c9b172ecd 100644 (file)
@@ -718,6 +718,10 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
                dev_vdbg(dwc->dev, "USB_REQ_SET_ISOCH_DELAY\n");
                ret = dwc3_ep0_set_isoch_delay(dwc, ctrl);
                break;
+       case USB_REQ_SET_INTERFACE:
+               dev_vdbg(dwc->dev, "USB_REQ_SET_INTERFACE\n");
+               dwc->start_config_issued = false;
+               /* Fall through */
        default:
                dev_vdbg(dwc->dev, "Forwarding to gadget driver\n");
                ret = dwc3_ep0_delegate_req(dwc, ctrl);
index 87f8fc63b3e1e0810b14c67e80e9968c94ce1846..6e70c88b25fb965c8470464c5f6541b0cc1ece95 100644 (file)
@@ -319,6 +319,8 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, int cmd, u32 param)
                if (!(reg & DWC3_DGCMD_CMDACT)) {
                        dev_vdbg(dwc->dev, "Command Complete --> %d\n",
                                        DWC3_DGCMD_STATUS(reg));
+                       if (DWC3_DGCMD_STATUS(reg))
+                               return -EINVAL;
                        return 0;
                }
 
@@ -355,6 +357,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
                if (!(reg & DWC3_DEPCMD_CMDACT)) {
                        dev_vdbg(dwc->dev, "Command Complete --> %d\n",
                                        DWC3_DEPCMD_STATUS(reg));
+                       if (DWC3_DEPCMD_STATUS(reg))
+                               return -EINVAL;
                        return 0;
                }
 
index d939376c5deee42de81af3e95bd7bc143f82ea46..0f71c3a22507d1743907239d657acb1a9feff2ab 100644 (file)
@@ -468,10 +468,13 @@ static void xhci_hub_report_link_state(struct xhci_hcd *xhci,
        u32 pls = status_reg & PORT_PLS_MASK;
 
        /* resume state is a xHCI internal state.
-        * Do not report it to usb core.
+        * Do not report it to usb core, instead, pretend to be U3,
+        * thus usb core knows it's not ready for transfer
         */
-       if (pls == XDEV_RESUME)
+       if (pls == XDEV_RESUME) {
+               *status |= USB_SS_PORT_LS_U3;
                return;
+       }
 
        /* When the CAS bit is set then warm reset
         * should be performed on port
@@ -1045,10 +1048,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
        spin_lock_irqsave(&xhci->lock, flags);
 
        if (hcd->self.root_hub->do_remote_wakeup) {
-               if (bus_state->resuming_ports) {
+               if (bus_state->resuming_ports ||        /* USB2 */
+                   bus_state->port_remote_wakeup) {    /* USB3 */
                        spin_unlock_irqrestore(&xhci->lock, flags);
-                       xhci_dbg(xhci, "suspend failed because "
-                                               "a port is resuming\n");
+                       xhci_dbg(xhci, "suspend failed because a port is resuming\n");
                        return -EBUSY;
                }
        }
index 677f032482f74ef207a739801b1cf1927579da8e..31bed5f7d0eb0819a83e40c8eb2cec0beb0c1b2f 100644 (file)
@@ -1400,10 +1400,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
                /* Attempt to use the ring cache */
                if (virt_dev->num_rings_cached == 0)
                        return -ENOMEM;
+               virt_dev->num_rings_cached--;
                virt_dev->eps[ep_index].new_ring =
                        virt_dev->ring_cache[virt_dev->num_rings_cached];
                virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL;
-               virt_dev->num_rings_cached--;
                xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring,
                                        1, type);
        }
index 30533952b4a340472abdf80ec981b218da6f1304..95fe1a432d29229056523a17ad003cf36e966ae0 100644 (file)
@@ -1669,6 +1669,9 @@ static void handle_port_status(struct xhci_hcd *xhci,
                usb_hcd_resume_root_hub(hcd);
        }
 
+       if (hcd->speed == HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE)
+               bus_state->port_remote_wakeup &= ~(1 << faked_port_index);
+
        if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) {
                xhci_dbg(xhci, "port resume event for port %d\n", port_id);
 
index 10223f2b18d20d0884b8e4328b86e56ced608666..1f901fc25590af7e0eddfcea18a739c05417564a 100644 (file)
@@ -3356,6 +3356,9 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
                        return -EINVAL;
        }
 
+       if (virt_dev->tt_info)
+               old_active_eps = virt_dev->tt_info->active_eps;
+
        if (virt_dev->udev != udev) {
                /* If the virt_dev and the udev does not match, this virt_dev
                 * may belong to another udev.
index ed8de724b285936fcccf416bf46961d87cf1779c..deb2537ae75c4c76afb5b4aec3c4f5e67e52bdc1 100644 (file)
@@ -280,6 +280,7 @@ struct xhci_op_regs {
 #define XDEV_U0                (0x0 << 5)
 #define XDEV_U2                (0x2 << 5)
 #define XDEV_U3                (0x3 << 5)
+#define XDEV_INACTIVE  (0x6 << 5)
 #define XDEV_RESUME    (0xf << 5)
 /* true: port has power (see HCC_PPC) */
 #define PORT_POWER     (1 << 9)
index 691a821051803f3c1acb5c15227d8b5decb5e772..dd84416a23cdc5bd1230a3e28a4e786ca6de071a 100644 (file)
@@ -128,6 +128,7 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
        { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */
        { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
+       { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
        { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
        { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
        { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
@@ -186,6 +187,7 @@ static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */
        { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */
        { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */
+       { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */
        { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
        { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
        { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
index 4d918d5f945a096d6c12deee12b78c2d3a0a8a30..b55e5f3a311d0d06a45072a56012ee56addc92c5 100644 (file)
@@ -715,6 +715,7 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) },
        { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) },
        { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
+       { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) },
        { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
        { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
index e906b6aa24244da3e535b27c6904bcac020d46f9..99316d7cfc03f9a29d15dae821a7ae3d17773e64 100644 (file)
 #define XSENS_AWINDA_STATION_PID 0x0101
 #define XSENS_AWINDA_DONGLE_PID 0x0102
 #define XSENS_MTW_PID          0x0200  /* Xsens MTw */
+#define XSENS_MTDEVBOARD_PID   0x0300  /* Motion Tracker Development Board */
 #define XSENS_CONVERTER_PID    0xD00D  /* Xsens USB-serial converter */
 
 /* Xsens devices using FTDI VID */
index 8b3484134ab032e75b66c4dffd84ab0e99cbf442..096438e4fb0cf59387efb9f33228e58777e5b37f 100644 (file)
@@ -1755,6 +1755,7 @@ static const struct usb_device_id option_ids[] = {
        { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
        { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
        { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
+       { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) },                /* OLICARD300 - MT6225 */
        { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
        { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
        { } /* Terminating entry */
index 821e1e2f70f65b6cb8436b7d910d49c094ed576f..da380a99c6b81855a076327d66ed289e12682c7e 100644 (file)
@@ -2032,6 +2032,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200,
                USB_SC_DEVICE, USB_PR_DEVICE, NULL,
                US_FL_NO_READ_DISC_INFO ),
 
+/* Reported by Oliver Neukum <oneukum@suse.com>
+ * This device morphes spontaneously into another device if the access
+ * pattern of Windows isn't followed. Thus writable media would be dirty
+ * if the initial instance is used. So the device is limited to its
+ * virtual CD.
+ * And yes, the concept that BCD goes up to 9 is not heeded */
+UNUSUAL_DEV( 0x19d2, 0x1225, 0x0000, 0xffff,
+               "ZTE,Incorporated",
+               "ZTE WCDMA Technologies MSM",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_SINGLE_LUN ),
+
 /* Reported by Sven Geggus <sven-usbst@geggus.net>
  * This encrypted pen drive returns bogus data for the initial READ(10).
  */
index 60aa5ad09a2fdb74a457ecadf0130f056f114c8e..3aabc652f1b945a455c6fe1231546dc8f043878d 100644 (file)
@@ -855,6 +855,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp)
                }
                if (eventfp != d->log_file) {
                        filep = d->log_file;
+                       d->log_file = eventfp;
                        ctx = d->log_ctx;
                        d->log_ctx = eventfp ?
                                eventfd_ctx_fileget(eventfp) : NULL;
index af88ffd1068f57ebd50354c7a6dd06fdf54af1f4..2b7e073f5e36a41a8bc2785732081a9f707895cc 100644 (file)
@@ -134,6 +134,13 @@ static int omap_wdt_start(struct watchdog_device *wdog)
 
        pm_runtime_get_sync(wdev->dev);
 
+       /*
+        * Make sure the watchdog is disabled. This is unfortunately required
+        * because writing to various registers with the watchdog running has no
+        * effect.
+        */
+       omap_wdt_disable(wdev);
+
        /* initialize prescaler */
        while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01)
                cpu_relax();
index d86edc8d3fd05a0176e73136eedb50641eb091b0..4c7d309e4aa6ea311852631f4852bf5013e1b04f 100644 (file)
@@ -537,8 +537,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
        unlock_new_inode(inode);
        return inode;
 error:
-       unlock_new_inode(inode);
-       iput(inode);
+       iget_failed(inode);
        return ERR_PTR(retval);
 
 }
index 53687bbf2296f8b799583786b16b59a574369f9e..65b21a24841e598522053659ab7b60f95406f121 100644 (file)
@@ -151,8 +151,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
        unlock_new_inode(inode);
        return inode;
 error:
-       unlock_new_inode(inode);
-       iput(inode);
+       iget_failed(inode);
        return ERR_PTR(retval);
 
 }
index 7fb054ba1b60124539643277d3204cc7e887ab0c..82f14a1da542eaa1186e2fb9e78b825e44b572dd 100644 (file)
@@ -2769,7 +2769,7 @@ done:
         */
        if (!p->leave_spinning)
                btrfs_set_path_blocking(p);
-       if (ret < 0)
+       if (ret < 0 && !p->skip_release_on_error)
                btrfs_release_path(p);
        return ret;
 }
index d6dd49b51ba8dfe27069a139ab42cfd88e58c117..c19444e412be4ec2d1d70f8cb543418831dbb0cf 100644 (file)
@@ -586,6 +586,7 @@ struct btrfs_path {
        unsigned int skip_locking:1;
        unsigned int leave_spinning:1;
        unsigned int search_commit_root:1;
+       unsigned int skip_release_on_error:1;
 };
 
 /*
@@ -3406,6 +3407,10 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
 int verify_dir_item(struct btrfs_root *root,
                    struct extent_buffer *leaf,
                    struct btrfs_dir_item *dir_item);
+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
+                                                struct btrfs_path *path,
+                                                const char *name,
+                                                int name_len);
 
 /* orphan.c */
 int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans,
index 79e594e341c7c7156ba28a116f9d66457b3a5e7d..6f61b9b1526f9065eaf18a01bbd756c94b82bfeb 100644 (file)
 #include "hash.h"
 #include "transaction.h"
 
-static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
-                             struct btrfs_path *path,
-                             const char *name, int name_len);
-
 /*
  * insert a name into a directory, doing overflow properly if there is a hash
  * collision.  data_size indicates how big the item inserted should be.  On
@@ -383,9 +379,9 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
  * this walks through all the entries in a dir item and finds one
  * for a specific name.
  */
-static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
-                             struct btrfs_path *path,
-                             const char *name, int name_len)
+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
+                                                struct btrfs_path *path,
+                                                const char *name, int name_len)
 {
        struct btrfs_dir_item *dir_item;
        unsigned long name_ptr;
index 84ceff6abbc11f66e8e3f96d24740d67cbacd1ed..be7e31a933e58011820ebb48c68f724128da5232 100644 (file)
@@ -4080,8 +4080,11 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
                }
                ret = fiemap_fill_next_extent(fieinfo, em_start, disko,
                                              em_len, flags);
-               if (ret)
+               if (ret) {
+                       if (ret == 1)
+                               ret = 0;
                        goto out_free;
+               }
        }
 out_free:
        free_extent_map(em);
index 2c66ddbbe670e0ab80753dc41eb4054aacd00388..0389e90eec3368cb65e01a77138812bbacdb99ba 100644 (file)
@@ -283,7 +283,7 @@ void btrfs_unpin_free_ino(struct btrfs_root *root)
                __btrfs_add_free_space(ctl, info->offset, count);
 free:
                rb_erase(&info->offset_index, rbroot);
-               kfree(info);
+               kmem_cache_free(btrfs_free_space_cachep, info);
        }
 }
 
index 461731c7fa3a3198c3756c748192521bd3a85c3c..feecdfbdffe4192e95d7676af1bb82f68609304f 100644 (file)
@@ -779,6 +779,15 @@ find_root:
        if (btrfs_root_refs(&new_root->root_item) == 0)
                return ERR_PTR(-ENOENT);
 
+       if (!(sb->s_flags & MS_RDONLY)) {
+               int ret;
+               down_read(&fs_info->cleanup_work_sem);
+               ret = btrfs_orphan_cleanup(new_root);
+               up_read(&fs_info->cleanup_work_sem);
+               if (ret)
+                       return ERR_PTR(ret);
+       }
+
        dir_id = btrfs_root_dirid(&new_root->root_item);
 setup_root:
        location.objectid = dir_id;
index 05740b9789e4f97dd92b65f0d000e87dac7558e6..9cf20d63cc998777541ce3e527272a1d06a0c157 100644 (file)
@@ -27,6 +27,7 @@
 #include "transaction.h"
 #include "xattr.h"
 #include "disk-io.h"
+#include "locking.h"
 
 
 ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
@@ -89,7 +90,7 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
                       struct inode *inode, const char *name,
                       const void *value, size_t size, int flags)
 {
-       struct btrfs_dir_item *di;
+       struct btrfs_dir_item *di = NULL;
        struct btrfs_root *root = BTRFS_I(inode)->root;
        struct btrfs_path *path;
        size_t name_len = strlen(name);
@@ -101,84 +102,128 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
        path = btrfs_alloc_path();
        if (!path)
                return -ENOMEM;
+       path->skip_release_on_error = 1;
+
+       if (!value) {
+               di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode),
+                                       name, name_len, -1);
+               if (!di && (flags & XATTR_REPLACE))
+                       ret = -ENODATA;
+               else if (di)
+                       ret = btrfs_delete_one_dir_name(trans, root, path, di);
+               goto out;
+       }
 
+       /*
+        * For a replace we can't just do the insert blindly.
+        * Do a lookup first (read-only btrfs_search_slot), and return if xattr
+        * doesn't exist. If it exists, fall down below to the insert/replace
+        * path - we can't race with a concurrent xattr delete, because the VFS
+        * locks the inode's i_mutex before calling setxattr or removexattr.
+        */
        if (flags & XATTR_REPLACE) {
-               di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), name,
-                                       name_len, -1);
-               if (IS_ERR(di)) {
-                       ret = PTR_ERR(di);
-                       goto out;
-               } else if (!di) {
+               if(!mutex_is_locked(&inode->i_mutex)) {
+                       pr_err("BTRFS: assertion failed: %s, file: %s, line: %d",
+                              "mutex_is_locked(&inode->i_mutex)", __FILE__,
+                              __LINE__);
+                       BUG();
+               }
+               di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode),
+                                       name, name_len, 0);
+               if (!di) {
                        ret = -ENODATA;
                        goto out;
                }
-               ret = btrfs_delete_one_dir_name(trans, root, path, di);
-               if (ret)
-                       goto out;
                btrfs_release_path(path);
+               di = NULL;
+       }
 
+       ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode),
+                                     name, name_len, value, size);
+       if (ret == -EOVERFLOW) {
                /*
-                * remove the attribute
+                * We have an existing item in a leaf, split_leaf couldn't
+                * expand it. That item might have or not a dir_item that
+                * matches our target xattr, so lets check.
                 */
-               if (!value)
-                       goto out;
-       } else {
-               di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode),
-                                       name, name_len, 0);
-               if (IS_ERR(di)) {
-                       ret = PTR_ERR(di);
+               ret = 0;
+               btrfs_assert_tree_locked(path->nodes[0]);
+               di = btrfs_match_dir_item_name(root, path, name, name_len);
+               if (!di && !(flags & XATTR_REPLACE)) {
+                       ret = -ENOSPC;
                        goto out;
                }
-               if (!di && !value)
-                       goto out;
-               btrfs_release_path(path);
+       } else if (ret == -EEXIST) {
+               ret = 0;
+               di = btrfs_match_dir_item_name(root, path, name, name_len);
+               if(!di) { /* logic error */
+                       pr_err("BTRFS: assertion failed: %s, file: %s, line: %d",
+                              "di", __FILE__, __LINE__);
+                       BUG();
+               }
+       } else if (ret) {
+               goto out;
        }
 
-again:
-       ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode),
-                                     name, name_len, value, size);
-       /*
-        * If we're setting an xattr to a new value but the new value is say
-        * exactly BTRFS_MAX_XATTR_SIZE, we could end up with EOVERFLOW getting
-        * back from split_leaf.  This is because it thinks we'll be extending
-        * the existing item size, but we're asking for enough space to add the
-        * item itself.  So if we get EOVERFLOW just set ret to EEXIST and let
-        * the rest of the function figure it out.
-        */
-       if (ret == -EOVERFLOW)
+       if (di && (flags & XATTR_CREATE)) {
                ret = -EEXIST;
+               goto out;
+       }
 
-       if (ret == -EEXIST) {
-               if (flags & XATTR_CREATE)
-                       goto out;
+       if (di) {
                /*
-                * We can't use the path we already have since we won't have the
-                * proper locking for a delete, so release the path and
-                * re-lookup to delete the thing.
+                * We're doing a replace, and it must be atomic, that is, at
+                * any point in time we have either the old or the new xattr
+                * value in the tree. We don't want readers (getxattr and
+                * listxattrs) to miss a value, this is specially important
+                * for ACLs.
                 */
-               btrfs_release_path(path);
-               di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode),
-                                       name, name_len, -1);
-               if (IS_ERR(di)) {
-                       ret = PTR_ERR(di);
-                       goto out;
-               } else if (!di) {
-                       /* Shouldn't happen but just in case... */
-                       btrfs_release_path(path);
-                       goto again;
+               const int slot = path->slots[0];
+               struct extent_buffer *leaf = path->nodes[0];
+               const u16 old_data_len = btrfs_dir_data_len(leaf, di);
+               const u32 item_size = btrfs_item_size_nr(leaf, slot);
+               const u32 data_size = sizeof(*di) + name_len + size;
+               struct btrfs_item *item;
+               unsigned long data_ptr;
+               char *ptr;
+
+               if (size > old_data_len) {
+                       if (btrfs_leaf_free_space(root, leaf) <
+                           (size - old_data_len)) {
+                               ret = -ENOSPC;
+                               goto out;
+                       }
                }
 
-               ret = btrfs_delete_one_dir_name(trans, root, path, di);
-               if (ret)
-                       goto out;
+               if (old_data_len + name_len + sizeof(*di) == item_size) {
+                       /* No other xattrs packed in the same leaf item. */
+                       if (size > old_data_len)
+                               btrfs_extend_item(root, path,
+                                                 size - old_data_len);
+                       else if (size < old_data_len)
+                               btrfs_truncate_item(root, path, data_size, 1);
+               } else {
+                       /* There are other xattrs packed in the same item. */
+                       ret = btrfs_delete_one_dir_name(trans, root, path, di);
+                       if (ret)
+                               goto out;
+                       btrfs_extend_item(root, path, data_size);
+               }
 
+               item = btrfs_item_nr(NULL, slot);
+               ptr = btrfs_item_ptr(leaf, slot, char);
+               ptr += btrfs_item_size(leaf, item) - data_size;
+               di = (struct btrfs_dir_item *)ptr;
+               btrfs_set_dir_data_len(leaf, di, size);
+               data_ptr = ((unsigned long)(di + 1)) + name_len;
+               write_extent_buffer(leaf, value, data_ptr, size);
+               btrfs_mark_buffer_dirty(leaf);
+       } else {
                /*
-                * We have a value to set, so go back and try to insert it now.
+                * Insert, and we had space for the xattr, so path->slots[0] is
+                * where our xattr dir_item is and btrfs_insert_xattr_item()
+                * filled it.
                 */
-               if (value) {
-                       btrfs_release_path(path);
-                       goto again;
-               }
        }
 out:
        btrfs_free_path(path);
index e2800926ae0574c342a393fe21ca318130cc8e07..90be2809e15aeb0ee67ff231df58498b5617e45e 100644 (file)
@@ -520,6 +520,9 @@ repeat:
                return;
        }
 
+       if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED))
+               goto kill_it;
+
        if (dentry->d_flags & DCACHE_OP_DELETE) {
                if (dentry->d_op->d_delete(dentry))
                        goto kill_it;
@@ -1053,13 +1056,13 @@ ascend:
                /* might go back up the wrong parent if we have had a rename. */
                if (!locked && read_seqretry(&rename_lock, seq))
                        goto rename_retry;
-               next = child->d_child.next;
-               while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) {
+               /* go into the first sibling still alive */
+               do {
+                       next = child->d_child.next;
                        if (next == &this_parent->d_subdirs)
                                goto ascend;
                        child = list_entry(next, struct dentry, d_child);
-                       next = next->next;
-               }
+               } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED));
                rcu_read_unlock();
                goto resume;
        }
@@ -2977,13 +2980,13 @@ ascend:
                /* might go back up the wrong parent if we have had a rename. */
                if (!locked && read_seqretry(&rename_lock, seq))
                        goto rename_retry;
-               next = child->d_child.next;
-               while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) {
+               /* go into the first sibling still alive */
+               do {
+                       next = child->d_child.next;
                        if (next == &this_parent->d_subdirs)
                                goto ascend;
                        child = list_entry(next, struct dentry, d_child);
-                       next = next->next;
-               }
+               } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED));
                rcu_read_unlock();
                goto resume;
        }
index cb7f31c71c6ba60e3e38118494c536751b0a2a7d..54965313c23180bf4c0d9470ec5d9cb8497cc971 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1265,6 +1265,53 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
        return res;
 }
 
+static void bprm_fill_uid(struct linux_binprm *bprm)
+{
+       struct inode *inode;
+       unsigned int mode;
+       kuid_t uid;
+       kgid_t gid;
+
+       /* clear any previous set[ug]id data from a previous binary */
+       bprm->cred->euid = current_euid();
+       bprm->cred->egid = current_egid();
+
+       if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
+               return;
+
+       if (task_no_new_privs(current))
+               return;
+
+       inode = file_inode(bprm->file);
+       mode = ACCESS_ONCE(inode->i_mode);
+       if (!(mode & (S_ISUID|S_ISGID)))
+               return;
+
+       /* Be careful if suid/sgid is set */
+       mutex_lock(&inode->i_mutex);
+
+       /* reload atomically mode/uid/gid now that lock held */
+       mode = inode->i_mode;
+       uid = inode->i_uid;
+       gid = inode->i_gid;
+       mutex_unlock(&inode->i_mutex);
+
+       /* We ignore suid/sgid if there are no mappings for them in the ns */
+       if (!kuid_has_mapping(bprm->cred->user_ns, uid) ||
+                !kgid_has_mapping(bprm->cred->user_ns, gid))
+               return;
+
+       if (mode & S_ISUID) {
+               bprm->per_clear |= PER_CLEAR_ON_SETID;
+               bprm->cred->euid = uid;
+       }
+
+       if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
+               bprm->per_clear |= PER_CLEAR_ON_SETID;
+               bprm->cred->egid = gid;
+       }
+}
+
 /* 
  * Fill the binprm structure from the inode. 
  * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
@@ -1273,39 +1320,12 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
  */
 int prepare_binprm(struct linux_binprm *bprm)
 {
-       umode_t mode;
-       struct inode * inode = file_inode(bprm->file);
        int retval;
 
-       mode = inode->i_mode;
        if (bprm->file->f_op == NULL)
                return -EACCES;
 
-       /* clear any previous set[ug]id data from a previous binary */
-       bprm->cred->euid = current_euid();
-       bprm->cred->egid = current_egid();
-
-       if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) &&
-           !task_no_new_privs(current) &&
-           kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) &&
-           kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) {
-               /* Set-uid? */
-               if (mode & S_ISUID) {
-                       bprm->per_clear |= PER_CLEAR_ON_SETID;
-                       bprm->cred->euid = inode->i_uid;
-               }
-
-               /* Set-gid? */
-               /*
-                * If setgid is set but no group execute bit then this
-                * is a candidate for mandatory locking, not a setgid
-                * executable.
-                */
-               if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
-                       bprm->per_clear |= PER_CLEAR_ON_SETID;
-                       bprm->cred->egid = inode->i_gid;
-               }
-       }
+       bprm_fill_uid(bprm);
 
        /* fill in binprm security blob */
        retval = security_bprm_set_creds(bprm);
index 5890614696870bdecef2ea18eb900741ebbeb339..b07a221c31386f068b0245b772507157ae3eaa0b 100644 (file)
@@ -577,7 +577,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode,
                                       EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
                EXT4_ERROR_INODE(inode, "Can't allocate blocks for "
                                 "non-extent mapped inodes with bigalloc");
-               return -ENOSPC;
+               return -EUCLEAN;
        }
 
        goal = ext4_find_goal(inode, map->m_lblk, partial);
index 8a277505a3bebb0933a07637feb605ccf9e40e37..10b71e4029a0e0908233eb3d9642c5ce1737efb6 100644 (file)
@@ -1412,7 +1412,7 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
 static void ext4_da_page_release_reservation(struct page *page,
                                             unsigned long offset)
 {
-       int to_release = 0;
+       int to_release = 0, contiguous_blks = 0;
        struct buffer_head *head, *bh;
        unsigned int curr_off = 0;
        struct inode *inode = page->mapping->host;
@@ -1427,14 +1427,23 @@ static void ext4_da_page_release_reservation(struct page *page,
 
                if ((offset <= curr_off) && (buffer_delay(bh))) {
                        to_release++;
+                       contiguous_blks++;
                        clear_buffer_delay(bh);
+               } else if (contiguous_blks) {
+                       lblk = page->index <<
+                              (PAGE_CACHE_SHIFT - inode->i_blkbits);
+                       lblk += (curr_off >> inode->i_blkbits) -
+                               contiguous_blks;
+                       ext4_es_remove_extent(inode, lblk, contiguous_blks);
+                       contiguous_blks = 0;
                }
                curr_off = next_off;
        } while ((bh = bh->b_this_page) != head);
 
-       if (to_release) {
+       if (contiguous_blks) {
                lblk = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
-               ext4_es_remove_extent(inode, lblk, to_release);
+               lblk += (curr_off >> inode->i_blkbits) - contiguous_blks;
+               ext4_es_remove_extent(inode, lblk, contiguous_blks);
        }
 
        /* If we have released all the blocks belonging to a cluster, then we
@@ -2099,19 +2108,32 @@ static int __ext4_journalled_writepage(struct page *page,
                ext4_walk_page_buffers(handle, page_bufs, 0, len,
                                       NULL, bget_one);
        }
-       /* As soon as we unlock the page, it can go away, but we have
-        * references to buffers so we are safe */
+       /*
+        * We need to release the page lock before we start the
+        * journal, so grab a reference so the page won't disappear
+        * out from under us.
+        */
+       get_page(page);
        unlock_page(page);
 
        handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE,
                                    ext4_writepage_trans_blocks(inode));
        if (IS_ERR(handle)) {
                ret = PTR_ERR(handle);
-               goto out;
+               put_page(page);
+               goto out_no_pagelock;
        }
-
        BUG_ON(!ext4_handle_valid(handle));
 
+       lock_page(page);
+       put_page(page);
+       if (page->mapping != mapping) {
+               /* The page got truncated from under us */
+               ext4_journal_stop(handle);
+               ret = 0;
+               goto out;
+       }
+
        if (inline_data) {
                ret = ext4_journal_get_write_access(handle, inode_bh);
 
@@ -2136,6 +2158,8 @@ static int __ext4_journalled_writepage(struct page *page,
                                       NULL, bput_one);
        ext4_set_inode_state(inode, EXT4_STATE_JDATA);
 out:
+       unlock_page(page);
+out_no_pagelock:
        brelse(inode_bh);
        return ret;
 }
index aed1a67ab3a2bfedac039faadac4967d5d099a1f..687ddf0f9423bba6b1bdf43e6430dddf0f26153d 100644 (file)
@@ -4765,18 +4765,12 @@ do_more:
                /*
                 * blocks being freed are metadata. these blocks shouldn't
                 * be used until this transaction is committed
+                *
+                * We use __GFP_NOFAIL because ext4_free_blocks() is not allowed
+                * to fail.
                 */
-       retry:
-               new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
-               if (!new_entry) {
-                       /*
-                        * We use a retry loop because
-                        * ext4_free_blocks() is not allowed to fail.
-                        */
-                       cond_resched();
-                       congestion_wait(BLK_RW_ASYNC, HZ/50);
-                       goto retry;
-               }
+               new_entry = kmem_cache_alloc(ext4_free_data_cachep,
+                               GFP_NOFS|__GFP_NOFAIL);
                new_entry->efd_start_cluster = bit;
                new_entry->efd_group = block_group;
                new_entry->efd_count = count_clusters;
index 49e8bdff9163e830931570f4c2660cea201ab3fd..d19efab66cb63466cd53efbf615c91bb39741df3 100644 (file)
@@ -616,6 +616,7 @@ int ext4_ind_migrate(struct inode *inode)
        struct ext4_inode_info          *ei = EXT4_I(inode);
        struct ext4_extent              *ex;
        unsigned int                    i, len;
+       ext4_lblk_t                     start, end;
        ext4_fsblk_t                    blk;
        handle_t                        *handle;
        int                             ret;
@@ -629,6 +630,14 @@ int ext4_ind_migrate(struct inode *inode)
                                       EXT4_FEATURE_RO_COMPAT_BIGALLOC))
                return -EOPNOTSUPP;
 
+       /*
+        * In order to get correct extent info, force all delayed allocation
+        * blocks to be allocated, otherwise delayed allocation blocks may not
+        * be reflected and bypass the checks on extent header.
+        */
+       if (test_opt(inode->i_sb, DELALLOC))
+               ext4_alloc_da_blocks(inode);
+
        handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1);
        if (IS_ERR(handle))
                return PTR_ERR(handle);
@@ -646,11 +655,13 @@ int ext4_ind_migrate(struct inode *inode)
                goto errout;
        }
        if (eh->eh_entries == 0)
-               blk = len = 0;
+               blk = len = start = end = 0;
        else {
                len = le16_to_cpu(ex->ee_len);
                blk = ext4_ext_pblock(ex);
-               if (len > EXT4_NDIR_BLOCKS) {
+               start = le32_to_cpu(ex->ee_block);
+               end = start + len - 1;
+               if (end >= EXT4_NDIR_BLOCKS) {
                        ret = -EOPNOTSUPP;
                        goto errout;
                }
@@ -658,7 +669,7 @@ int ext4_ind_migrate(struct inode *inode)
 
        ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS);
        memset(ei->i_data, 0, sizeof(ei->i_data));
-       for (i=0; i < len; i++)
+       for (i = start; i <= end; i++)
                ei->i_data[i] = cpu_to_le32(blk++);
        ext4_mark_inode_dirty(handle, inode);
 errout:
index 064177f6acd97b730548c1d16eae6f7da99fa0d2..d18e0a4056baac55ab82529efae91b961885bed9 100644 (file)
@@ -805,6 +805,7 @@ static void ext4_put_super(struct super_block *sb)
                dump_orphan_list(sb, sbi);
        J_ASSERT(list_empty(&sbi->s_orphan));
 
+       sync_blockdev(sb->s_bdev);
        invalidate_bdev(sb->s_bdev);
        if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) {
                /*
index 54a34be444f904353a6cf2d2a669ccc0c559bd4f..28f02a7cbba189203bf9a77f454db0e8571292a2 100644 (file)
@@ -36,8 +36,6 @@ struct files_stat_struct files_stat = {
        .max_files = NR_FILE
 };
 
-DEFINE_STATIC_LGLOCK(files_lglock);
-
 /* SLAB cache for file structures */
 static struct kmem_cache *filp_cachep __read_mostly;
 
@@ -134,7 +132,6 @@ struct file *get_empty_filp(void)
                return ERR_PTR(error);
        }
 
-       INIT_LIST_HEAD(&f->f_u.fu_list);
        atomic_long_set(&f->f_count, 1);
        rwlock_init(&f->f_owner.lock);
        spin_lock_init(&f->f_lock);
@@ -265,18 +262,15 @@ static void __fput(struct file *file)
        mntput(mnt);
 }
 
-static DEFINE_SPINLOCK(delayed_fput_lock);
-static LIST_HEAD(delayed_fput_list);
+static LLIST_HEAD(delayed_fput_list);
 static void delayed_fput(struct work_struct *unused)
 {
-       LIST_HEAD(head);
-       spin_lock_irq(&delayed_fput_lock);
-       list_splice_init(&delayed_fput_list, &head);
-       spin_unlock_irq(&delayed_fput_lock);
-       while (!list_empty(&head)) {
-               struct file *f = list_first_entry(&head, struct file, f_u.fu_list);
-               list_del_init(&f->f_u.fu_list);
-               __fput(f);
+       struct llist_node *node = llist_del_all(&delayed_fput_list);
+       struct llist_node *next;
+
+       for (; node; node = next) {
+               next = llist_next(node);
+               __fput(llist_entry(node, struct file, f_u.fu_llist));
        }
 }
 
@@ -306,18 +300,15 @@ void fput(struct file *file)
 {
        if (atomic_long_dec_and_test(&file->f_count)) {
                struct task_struct *task = current;
-               unsigned long flags;
 
-               file_sb_list_del(file);
                if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) {
                        init_task_work(&file->f_u.fu_rcuhead, ____fput);
                        if (!task_work_add(task, &file->f_u.fu_rcuhead, true))
                                return;
                }
-               spin_lock_irqsave(&delayed_fput_lock, flags);
-               list_add(&file->f_u.fu_list, &delayed_fput_list);
-               schedule_work(&delayed_fput_work);
-               spin_unlock_irqrestore(&delayed_fput_lock, flags);
+
+               if (llist_add(&file->f_u.fu_llist, &delayed_fput_list))
+                       schedule_work(&delayed_fput_work);
        }
 }
 
@@ -333,7 +324,6 @@ void __fput_sync(struct file *file)
 {
        if (atomic_long_dec_and_test(&file->f_count)) {
                struct task_struct *task = current;
-               file_sb_list_del(file);
                BUG_ON(!(task->flags & PF_KTHREAD));
                __fput(file);
        }
@@ -345,127 +335,10 @@ void put_filp(struct file *file)
 {
        if (atomic_long_dec_and_test(&file->f_count)) {
                security_file_free(file);
-               file_sb_list_del(file);
                file_free(file);
        }
 }
 
-static inline int file_list_cpu(struct file *file)
-{
-#ifdef CONFIG_SMP
-       return file->f_sb_list_cpu;
-#else
-       return smp_processor_id();
-#endif
-}
-
-/* helper for file_sb_list_add to reduce ifdefs */
-static inline void __file_sb_list_add(struct file *file, struct super_block *sb)
-{
-       struct list_head *list;
-#ifdef CONFIG_SMP
-       int cpu;
-       cpu = smp_processor_id();
-       file->f_sb_list_cpu = cpu;
-       list = per_cpu_ptr(sb->s_files, cpu);
-#else
-       list = &sb->s_files;
-#endif
-       list_add(&file->f_u.fu_list, list);
-}
-
-/**
- * file_sb_list_add - add a file to the sb's file list
- * @file: file to add
- * @sb: sb to add it to
- *
- * Use this function to associate a file with the superblock of the inode it
- * refers to.
- */
-void file_sb_list_add(struct file *file, struct super_block *sb)
-{
-       lg_local_lock(&files_lglock);
-       __file_sb_list_add(file, sb);
-       lg_local_unlock(&files_lglock);
-}
-
-/**
- * file_sb_list_del - remove a file from the sb's file list
- * @file: file to remove
- * @sb: sb to remove it from
- *
- * Use this function to remove a file from its superblock.
- */
-void file_sb_list_del(struct file *file)
-{
-       if (!list_empty(&file->f_u.fu_list)) {
-               lg_local_lock_cpu(&files_lglock, file_list_cpu(file));
-               list_del_init(&file->f_u.fu_list);
-               lg_local_unlock_cpu(&files_lglock, file_list_cpu(file));
-       }
-}
-
-#ifdef CONFIG_SMP
-
-/*
- * These macros iterate all files on all CPUs for a given superblock.
- * files_lglock must be held globally.
- */
-#define do_file_list_for_each_entry(__sb, __file)              \
-{                                                              \
-       int i;                                                  \
-       for_each_possible_cpu(i) {                              \
-               struct list_head *list;                         \
-               list = per_cpu_ptr((__sb)->s_files, i);         \
-               list_for_each_entry((__file), list, f_u.fu_list)
-
-#define while_file_list_for_each_entry                         \
-       }                                                       \
-}
-
-#else
-
-#define do_file_list_for_each_entry(__sb, __file)              \
-{                                                              \
-       struct list_head *list;                                 \
-       list = &(sb)->s_files;                                  \
-       list_for_each_entry((__file), list, f_u.fu_list)
-
-#define while_file_list_for_each_entry                         \
-}
-
-#endif
-
-/**
- *     mark_files_ro - mark all files read-only
- *     @sb: superblock in question
- *
- *     All files are marked read-only.  We don't care about pending
- *     delete files so this should be used in 'force' mode only.
- */
-void mark_files_ro(struct super_block *sb)
-{
-       struct file *f;
-
-       lg_global_lock(&files_lglock);
-       do_file_list_for_each_entry(sb, f) {
-               if (!S_ISREG(file_inode(f)->i_mode))
-                      continue;
-               if (!file_count(f))
-                       continue;
-               if (!(f->f_mode & FMODE_WRITE))
-                       continue;
-               spin_lock(&f->f_lock);
-               f->f_mode &= ~FMODE_WRITE;
-               spin_unlock(&f->f_lock);
-               if (file_check_writeable(f) != 0)
-                       continue;
-               __mnt_drop_write(f->f_path.mnt);
-               file_release_write(f);
-       } while_file_list_for_each_entry;
-       lg_global_unlock(&files_lglock);
-}
-
 void __init files_init(unsigned long mempages)
 { 
        unsigned long n;
@@ -481,6 +354,5 @@ void __init files_init(unsigned long mempages)
        n = (mempages * (PAGE_SIZE / 1024)) / 10;
        files_stat.max_files = max_t(unsigned long, n, NR_FILE);
        files_defer_init();
-       lg_lock_init(&files_lglock, "files_lglock");
        percpu_counter_init(&nr_files, 0);
 } 
index 8aabbe2a398968bb806d5610c3e26005980b56dd..09eef07afeb20fa9bfcd6e5f5df4fa94c4112d39 100644 (file)
@@ -1029,6 +1029,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
                goto err_fput;
 
        fuse_conn_init(fc);
+       fc->release = fuse_free_conn;
 
        fc->dev = sb->s_dev;
        fc->sb = sb;
@@ -1043,7 +1044,6 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
                fc->dont_mask = 1;
        sb->s_flags |= MS_POSIXACL;
 
-       fc->release = fuse_free_conn;
        fc->flags = d.flags;
        fc->user_id = d.user_id;
        fc->group_id = d.group_id;
index d37f6ff8e07f6fe076e8541d11522ea607eba1e6..0d4b1f657804c06ea735b2fd497f43614a43edf6 100644 (file)
@@ -52,17 +52,20 @@ static void unmark_dirty(struct super_block *s)
 }
 
 /* Filesystem error... */
-static char err_buf[1024];
-
 void hpfs_error(struct super_block *s, const char *fmt, ...)
 {
+       struct va_format vaf;
        va_list args;
 
        va_start(args, fmt);
-       vsnprintf(err_buf, sizeof(err_buf), fmt, args);
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       pr_err("filesystem error: %pV", &vaf);
+
        va_end(args);
 
-       printk("HPFS: filesystem error: %s", err_buf);
        if (!hpfs_sb(s)->sb_was_error) {
                if (hpfs_sb(s)->sb_err == 2) {
                        printk("; crashing the system because you wanted it\n");
index 1b300a06b8be34d822eb6b75d9ff0a8535aa0d2c..17f95b417955d35ecf1372cbff94420fe9d64286 100644 (file)
@@ -1628,8 +1628,8 @@ int file_remove_suid(struct file *file)
                error = security_inode_killpriv(dentry);
        if (!error && killsuid)
                error = __remove_suid(dentry, killsuid);
-       if (!error && (inode->i_sb->s_flags & MS_NOSEC))
-               inode->i_flags |= S_NOSEC;
+       if (!error)
+               inode_has_no_xattr(inode);
 
        return error;
 }
index 68121584ae37d40a074bf81e55184ecb1674d882..2ffa65a36ca01de1dfa779e48aa7866cb4fa45da 100644 (file)
@@ -74,9 +74,6 @@ extern void chroot_fs_refs(const struct path *, const struct path *);
 /*
  * file_table.c
  */
-extern void file_sb_list_add(struct file *f, struct super_block *sb);
-extern void file_sb_list_del(struct file *f);
-extern void mark_files_ro(struct super_block *);
 extern struct file *get_empty_filp(void);
 
 /*
index c78841ee81cf31a0c4c67a23bca294a32720cb5f..6bb52859cb866a12e804453c77d3f0a301fe327b 100644 (file)
@@ -440,7 +440,7 @@ int jbd2_cleanup_journal_tail(journal_t *journal)
        unsigned long   blocknr;
 
        if (is_journal_aborted(journal))
-               return 1;
+               return -EIO;
 
        if (!jbd2_journal_get_log_tail(journal, &first_tid, &blocknr))
                return 1;
@@ -455,10 +455,9 @@ int jbd2_cleanup_journal_tail(journal_t *journal)
         * jbd2_cleanup_journal_tail() doesn't get called all that often.
         */
        if (journal->j_flags & JBD2_BARRIER)
-               blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
+               blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL);
 
-       __jbd2_update_log_tail(journal, first_tid, blocknr);
-       return 0;
+       return __jbd2_update_log_tail(journal, first_tid, blocknr);
 }
 
 
index aaa1a3f33b0e951150203e4426c377af0d1605e2..3e7ef8874ffb17929d185cdd57ed7d3ddfd86e42 100644 (file)
@@ -869,9 +869,10 @@ int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
  *
  * Requires j_checkpoint_mutex
  */
-void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block)
+int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block)
 {
        unsigned long freed;
+       int ret;
 
        BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
 
@@ -881,7 +882,10 @@ void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block)
         * space and if we lose sb update during power failure we'd replay
         * old transaction with possibly newly overwritten data.
         */
-       jbd2_journal_update_sb_log_tail(journal, tid, block, WRITE_FUA);
+       ret = jbd2_journal_update_sb_log_tail(journal, tid, block, WRITE_FUA);
+       if (ret)
+               goto out;
+
        write_lock(&journal->j_state_lock);
        freed = block - journal->j_tail;
        if (block < journal->j_tail)
@@ -897,6 +901,9 @@ void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block)
        journal->j_tail_sequence = tid;
        journal->j_tail = block;
        write_unlock(&journal->j_state_lock);
+
+out:
+       return ret;
 }
 
 /*
@@ -1315,7 +1322,7 @@ static int journal_reset(journal_t *journal)
        return jbd2_journal_start_thread(journal);
 }
 
-static void jbd2_write_superblock(journal_t *journal, int write_op)
+static int jbd2_write_superblock(journal_t *journal, int write_op)
 {
        struct buffer_head *bh = journal->j_sb_buffer;
        journal_superblock_t *sb = journal->j_superblock;
@@ -1354,7 +1361,10 @@ static void jbd2_write_superblock(journal_t *journal, int write_op)
                printk(KERN_ERR "JBD2: Error %d detected when updating "
                       "journal superblock for %s.\n", ret,
                       journal->j_devname);
+               jbd2_journal_abort(journal, ret);
        }
+
+       return ret;
 }
 
 /**
@@ -1367,10 +1377,11 @@ static void jbd2_write_superblock(journal_t *journal, int write_op)
  * Update a journal's superblock information about log tail and write it to
  * disk, waiting for the IO to complete.
  */
-void jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,
+int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,
                                     unsigned long tail_block, int write_op)
 {
        journal_superblock_t *sb = journal->j_superblock;
+       int ret;
 
        BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
        jbd_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n",
@@ -1379,13 +1390,18 @@ void jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,
        sb->s_sequence = cpu_to_be32(tail_tid);
        sb->s_start    = cpu_to_be32(tail_block);
 
-       jbd2_write_superblock(journal, write_op);
+       ret = jbd2_write_superblock(journal, write_op);
+       if (ret)
+               goto out;
 
        /* Log is no longer empty */
        write_lock(&journal->j_state_lock);
        WARN_ON(!sb->s_sequence);
        journal->j_flags &= ~JBD2_FLUSHED;
        write_unlock(&journal->j_state_lock);
+
+out:
+       return ret;
 }
 
 /**
@@ -1922,7 +1938,14 @@ int jbd2_journal_flush(journal_t *journal)
                return -EIO;
 
        mutex_lock(&journal->j_checkpoint_mutex);
-       jbd2_cleanup_journal_tail(journal);
+       if (!err) {
+               err = jbd2_cleanup_journal_tail(journal);
+               if (err < 0) {
+                       mutex_unlock(&journal->j_checkpoint_mutex);
+                       goto out;
+               }
+               err = 0;
+       }
 
        /* Finally, mark the journal as really needing no recovery.
         * This sets s_start==0 in the underlying superblock, which is
@@ -1938,7 +1961,8 @@ int jbd2_journal_flush(journal_t *journal)
        J_ASSERT(journal->j_head == journal->j_tail);
        J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence);
        write_unlock(&journal->j_state_lock);
-       return 0;
+out:
+       return err;
 }
 
 /**
index fa6d72131c19e64565df105eeb9ed472bb180bf0..4495cad189c305c2c3db26825249e2ea185df907 100644 (file)
@@ -1342,7 +1342,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req,
        if (args->npages != 0)
                xdr_write_pages(xdr, args->pages, 0, args->len);
        else
-               xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE);
+               xdr_reserve_space(xdr, args->len);
 
        error = nfsacl_encode(xdr->buf, base, args->inode,
                            (args->mask & NFS_ACL) ?
index d482b86d0e0bcfff249d5bb57517632152cc01a4..cfa9163b3bb7066996af235397c66279eda5b437 100644 (file)
@@ -1452,6 +1452,8 @@ restart:
                                }
                                spin_unlock(&state->state_lock);
                                nfs4_put_open_state(state);
+                               clear_bit(NFS4CLNT_RECLAIM_NOGRACE,
+                                       &state->flags);
                                spin_lock(&sp->so_lock);
                                goto restart;
                        }
index 86092bde31f4827eec31eec454ec60e2c1dcb1e8..5f129683b7d7eb39128f98ccf2dff05ea1f98057 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -674,7 +674,6 @@ static int do_dentry_open(struct file *f,
        }
 
        f->f_mapping = inode->i_mapping;
-       file_sb_list_add(f, inode->i_sb);
 
        if (unlikely(f->f_mode & FMODE_PATH)) {
                f->f_op = &empty_fops;
@@ -709,7 +708,6 @@ static int do_dentry_open(struct file *f,
 
 cleanup_all:
        fops_put(f->f_op);
-       file_sb_list_del(f);
        if (f->f_mode & FMODE_WRITE) {
                if (!special_file(inode->i_mode)) {
                        /*
index 0e0752ef27159f6183dabc1749e49fca8494319a..3e7ab278bb0c0a3797e5112f30638c05851826fa 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -117,25 +117,27 @@ void pipe_wait(struct pipe_inode_info *pipe)
 }
 
 static int
-pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len,
-                       int atomic)
+pipe_iov_copy_from_user(void *addr, int *offset, struct iovec *iov,
+                       size_t *remaining, int atomic)
 {
        unsigned long copy;
 
-       while (len > 0) {
+       while (*remaining > 0) {
                while (!iov->iov_len)
                        iov++;
-               copy = min_t(unsigned long, len, iov->iov_len);
+               copy = min_t(unsigned long, *remaining, iov->iov_len);
 
                if (atomic) {
-                       if (__copy_from_user_inatomic(to, iov->iov_base, copy))
+                       if (__copy_from_user_inatomic(addr + *offset,
+                                                     iov->iov_base, copy))
                                return -EFAULT;
                } else {
-                       if (copy_from_user(to, iov->iov_base, copy))
+                       if (copy_from_user(addr + *offset,
+                                          iov->iov_base, copy))
                                return -EFAULT;
                }
-               to += copy;
-               len -= copy;
+               *offset += copy;
+               *remaining -= copy;
                iov->iov_base += copy;
                iov->iov_len -= copy;
        }
@@ -143,25 +145,27 @@ pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len,
 }
 
 static int
-pipe_iov_copy_to_user(struct iovec *iov, const void *from, unsigned long len,
-                     int atomic)
+pipe_iov_copy_to_user(struct iovec *iov, void *addr, int *offset,
+                     size_t *remaining, int atomic)
 {
        unsigned long copy;
 
-       while (len > 0) {
+       while (*remaining > 0) {
                while (!iov->iov_len)
                        iov++;
-               copy = min_t(unsigned long, len, iov->iov_len);
+               copy = min_t(unsigned long, *remaining, iov->iov_len);
 
                if (atomic) {
-                       if (__copy_to_user_inatomic(iov->iov_base, from, copy))
+                       if (__copy_to_user_inatomic(iov->iov_base,
+                                                   addr + *offset, copy))
                                return -EFAULT;
                } else {
-                       if (copy_to_user(iov->iov_base, from, copy))
+                       if (copy_to_user(iov->iov_base,
+                                        addr + *offset, copy))
                                return -EFAULT;
                }
-               from += copy;
-               len -= copy;
+               *offset += copy;
+               *remaining -= copy;
                iov->iov_base += copy;
                iov->iov_len -= copy;
        }
@@ -395,7 +399,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
                        struct pipe_buffer *buf = pipe->bufs + curbuf;
                        const struct pipe_buf_operations *ops = buf->ops;
                        void *addr;
-                       size_t chars = buf->len;
+                       size_t chars = buf->len, remaining;
                        int error, atomic;
 
                        if (chars > total_len)
@@ -409,9 +413,11 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
                        }
 
                        atomic = !iov_fault_in_pages_write(iov, chars);
+                       remaining = chars;
 redo:
                        addr = ops->map(pipe, buf, atomic);
-                       error = pipe_iov_copy_to_user(iov, addr + buf->offset, chars, atomic);
+                       error = pipe_iov_copy_to_user(iov, addr, &buf->offset,
+                                                     &remaining, atomic);
                        ops->unmap(pipe, buf, addr);
                        if (unlikely(error)) {
                                /*
@@ -426,7 +432,6 @@ redo:
                                break;
                        }
                        ret += chars;
-                       buf->offset += chars;
                        buf->len -= chars;
 
                        /* Was it a packet buffer? Clean up and exit */
@@ -531,6 +536,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
                if (ops->can_merge && offset + chars <= PAGE_SIZE) {
                        int error, atomic = 1;
                        void *addr;
+                       size_t remaining = chars;
 
                        error = ops->confirm(pipe, buf);
                        if (error)
@@ -539,8 +545,8 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
                        iov_fault_in_pages_read(iov, chars);
 redo1:
                        addr = ops->map(pipe, buf, atomic);
-                       error = pipe_iov_copy_from_user(offset + addr, iov,
-                                                       chars, atomic);
+                       error = pipe_iov_copy_from_user(addr, &offset, iov,
+                                                       &remaining, atomic);
                        ops->unmap(pipe, buf, addr);
                        ret = error;
                        do_wakeup = 1;
@@ -575,6 +581,8 @@ redo1:
                        struct page *page = pipe->tmp_page;
                        char *src;
                        int error, atomic = 1;
+                       int offset = 0;
+                       size_t remaining;
 
                        if (!page) {
                                page = alloc_page(GFP_HIGHUSER);
@@ -595,14 +603,15 @@ redo1:
                                chars = total_len;
 
                        iov_fault_in_pages_read(iov, chars);
+                       remaining = chars;
 redo2:
                        if (atomic)
                                src = kmap_atomic(page);
                        else
                                src = kmap(page);
 
-                       error = pipe_iov_copy_from_user(src, iov, chars,
-                                                       atomic);
+                       error = pipe_iov_copy_from_user(src, &offset, iov,
+                                                       &remaining, atomic);
                        if (atomic)
                                kunmap_atomic(src);
                        else
index e028b508db253ea3a134325fc5f8d2984554c1d9..97280e76179c5f5dd79d109a527e23103c62b1b6 100644 (file)
@@ -163,19 +163,6 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
                        s = NULL;
                        goto out;
                }
-#ifdef CONFIG_SMP
-               s->s_files = alloc_percpu(struct list_head);
-               if (!s->s_files)
-                       goto err_out;
-               else {
-                       int i;
-
-                       for_each_possible_cpu(i)
-                               INIT_LIST_HEAD(per_cpu_ptr(s->s_files, i));
-               }
-#else
-               INIT_LIST_HEAD(&s->s_files);
-#endif
                if (init_sb_writers(s, type))
                        goto err_out;
                s->s_flags = flags;
@@ -225,10 +212,6 @@ out:
        return s;
 err_out:
        security_sb_free(s);
-#ifdef CONFIG_SMP
-       if (s->s_files)
-               free_percpu(s->s_files);
-#endif
        destroy_sb_writers(s);
        kfree(s);
        s = NULL;
@@ -243,9 +226,6 @@ err_out:
  */
 static inline void destroy_super(struct super_block *s)
 {
-#ifdef CONFIG_SMP
-       free_percpu(s->s_files);
-#endif
        destroy_sb_writers(s);
        security_sb_free(s);
        WARN_ON(!list_empty(&s->s_mounts));
@@ -727,7 +707,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
           make sure there are no rw files opened */
        if (remount_ro) {
                if (force) {
-                       mark_files_ro(sb);
+                       sb->s_readonly_remount = 1;
+                       smp_wmb();
                } else {
                        retval = sb_prepare_remount_readonly(sb);
                        if (retval)
index 195a403e1522bbed00cb0f843b1d53c885db0e0d..61dbe1958a30f0a3330e870b384adb659f5f00d7 100644 (file)
@@ -272,7 +272,7 @@ xfs_readlink_bmap(
                        cur_chunk += sizeof(struct xfs_dsymlink_hdr);
                }
 
-               memcpy(link + offset, bp->b_addr, byte_cnt);
+               memcpy(link + offset, cur_chunk, byte_cnt);
 
                pathlen -= byte_cnt;
                offset += byte_cnt;
index f819e813c8ac33373d1ea7acf2d5137ce890cecd..4407354c7d6a390b49d989cec92ebe06ab0c8d10 100644 (file)
@@ -511,6 +511,7 @@ typedef u64 acpi_integer;
 #define ACPI_NO_ACPI_ENABLE             0x10
 #define ACPI_NO_DEVICE_INIT             0x20
 #define ACPI_NO_OBJECT_INIT             0x40
+#define ACPI_NO_FACS_INIT               0x80
 
 /*
  * Initialization state
index 9a3437377f718c2e24308a18513fe15d7c6e626d..4510759c9c1a7cbe0d6bf4c41ac0ee45825b16f8 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/stat.h>
 #include <linux/cache.h>
 #include <linux/list.h>
+#include <linux/llist.h>
 #include <linux/radix-tree.h>
 #include <linux/rbtree.h>
 #include <linux/init.h>
@@ -761,12 +762,8 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
 #define FILE_MNT_WRITE_RELEASED        2
 
 struct file {
-       /*
-        * fu_list becomes invalid after file_free is called and queued via
-        * fu_rcuhead for RCU freeing
-        */
        union {
-               struct list_head        fu_list;
+               struct llist_node       fu_llist;
                struct rcu_head         fu_rcuhead;
        } f_u;
        struct path             f_path;
@@ -779,9 +776,6 @@ struct file {
         * Must not be taken from IRQ context.
         */
        spinlock_t              f_lock;
-#ifdef CONFIG_SMP
-       int                     f_sb_list_cpu;
-#endif
        atomic_long_t           f_count;
        unsigned int            f_flags;
        fmode_t                 f_mode;
@@ -1257,11 +1251,6 @@ struct super_block {
 
        struct list_head        s_inodes;       /* all inodes */
        struct hlist_bl_head    s_anon;         /* anonymous dentries for (nfs) exporting */
-#ifdef CONFIG_SMP
-       struct list_head __percpu *s_files;
-#else
-       struct list_head        s_files;
-#endif
        struct list_head        s_mounts;       /* list of mounts; _not_ for fs use */
        /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */
        struct list_head        s_dentry_lru;   /* unused dentry lru */
index 6e051f472edb6db62f7e292b71c3bc5b2c5575f5..0c67c1f2a890bb9a7993b610770b7ef124f1af91 100644 (file)
@@ -997,7 +997,7 @@ extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *);
 int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
 int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid,
                              unsigned long *block);
-void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
+int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
 void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block);
 
 /* Commit management */
@@ -1116,7 +1116,7 @@ extern int           jbd2_journal_recover    (journal_t *journal);
 extern int        jbd2_journal_wipe       (journal_t *, int);
 extern int        jbd2_journal_skip_recovery   (journal_t *);
 extern void       jbd2_journal_update_sb_errno(journal_t *);
-extern void       jbd2_journal_update_sb_log_tail      (journal_t *, tid_t,
+extern int        jbd2_journal_update_sb_log_tail      (journal_t *, tid_t,
                                unsigned long, int);
 extern void       __jbd2_journal_abort_hard    (journal_t *);
 extern void       jbd2_journal_abort      (journal_t *, int);
index 8e5d45fa83cfb71872527cc5a4e2887d50f406d9..8ad0771b88abfd4589f01e07cd446e93f0bc9107 100644 (file)
@@ -409,6 +409,7 @@ enum {
        ATA_HORKAGE_ATAPI_DMADIR = (1 << 18),   /* device requires dmadir */
        ATA_HORKAGE_NOLPM       = (1 << 20),    /* don't use LPM */
        ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21),  /* some WDs have broken LPM */
+       ATA_HORKAGE_NOTRIM = (1 << 24),         /* don't use TRIM */
 
         /* DMA mask for user DMA control: User visible values; DO NOT
            renumber */
index dba482e31a130e2e29690bf0c63e36b1e88e6aa8..e80b9c7ec8da36ca68c1fcf655bde677f350c745 100644 (file)
@@ -67,6 +67,6 @@ int mvebu_mbus_add_window(const char *devname, phys_addr_t base,
 int mvebu_mbus_del_window(phys_addr_t base, size_t size);
 int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
                    size_t mbus_size, phys_addr_t sdram_phys_base,
-                   size_t sdram_size);
+                   size_t sdram_size, int is_coherent);
 
 #endif /* __LINUX_MBUS_H */
index 54e351aa4d2e5652c03711ec70e416b71d7ee3a5..a9e5134c2936fe629a20ef671ea21651e4c0f79a 100644 (file)
@@ -1094,7 +1094,7 @@ struct pnfs_ds_commit_info {
        struct pnfs_commit_bucket *buckets;
 };
 
-#define NFS4_EXCHANGE_ID_LEN   (48)
+#define NFS4_EXCHANGE_ID_LEN   (127)
 struct nfs41_exchange_id_args {
        struct nfs_client               *client;
        nfs4_verifier                   *verifier;
index 059749ab3943fc00a49ca6934568c3c7d2814b88..e5c222878555a52915bb7f4568827dd94c13cd11 100644 (file)
@@ -2240,15 +2240,15 @@ static inline bool thread_group_leader(struct task_struct *p)
  * all we care about is that we have a task with the appropriate
  * pid, we don't actually care if we have the right task.
  */
-static inline int has_group_leader_pid(struct task_struct *p)
+static inline bool has_group_leader_pid(struct task_struct *p)
 {
-       return p->pid == p->tgid;
+       return task_pid(p) == p->signal->leader_pid;
 }
 
 static inline
-int same_thread_group(struct task_struct *p1, struct task_struct *p2)
+bool same_thread_group(struct task_struct *p1, struct task_struct *p2)
 {
-       return p1->tgid == p2->tgid;
+       return p1->signal == p2->signal;
 }
 
 static inline struct task_struct *next_thread(const struct task_struct *p)
index 665e0cee59bd954bf08fa92ed6277089540bd9dd..5e661a979694e87d2679e395aa0dce0da033942f 100644 (file)
@@ -301,7 +301,7 @@ extern void                 inet6_rt_notify(int event, struct rt6_info *rt,
                                                struct nl_info *info);
 
 extern void                    fib6_run_gc(unsigned long expires,
-                                           struct net *net);
+                                           struct net *net, bool force);
 
 extern void                    fib6_gc_cleanup(void);
 
index 0c65e4b1261717f71b7bdeef94da72b608eec392..ef29266ef77a17fb8bb7ef522fd6c20aaccfc020 100644 (file)
@@ -125,11 +125,12 @@ struct usbdevfs_hub_portinfo {
        char port [127];        /* e.g. port 3 connects to device 27 */
 };
 
-/* Device capability flags */
+/* System and bus capability flags */
 #define USBDEVFS_CAP_ZERO_PACKET               0x01
 #define USBDEVFS_CAP_BULK_CONTINUATION         0x02
 #define USBDEVFS_CAP_NO_PACKET_SIZE_LIM                0x04
 #define USBDEVFS_CAP_BULK_SCATTER_GATHER       0x08
+#define USBDEVFS_CAP_REAP_AFTER_DISCONNECT     0x10
 
 /* USBDEVFS_DISCONNECT_CLAIM flags & struct */
 
index 9065107f083e90e3fbd3c38f2fbc164d11ff2b3c..7a5237a1bce5b5626d74cdb377f8e5a900d06f7a 100644 (file)
@@ -75,13 +75,21 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq)
                    !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) {
 #ifdef CONFIG_HARDIRQS_SW_RESEND
                        /*
-                        * If the interrupt has a parent irq and runs
-                        * in the thread context of the parent irq,
-                        * retrigger the parent.
+                        * If the interrupt is running in the thread
+                        * context of the parent irq we need to be
+                        * careful, because we cannot trigger it
+                        * directly.
                         */
-                       if (desc->parent_irq &&
-                           irq_settings_is_nested_thread(desc))
+                       if (irq_settings_is_nested_thread(desc)) {
+                               /*
+                                * If the parent_irq is valid, we
+                                * retrigger the parent, otherwise we
+                                * do nothing.
+                                */
+                               if (!desc->parent_irq)
+                                       return;
                                irq = desc->parent_irq;
+                       }
                        /* Set it pending and activate the softirq: */
                        set_bit(irq, irqs_resend);
                        tasklet_schedule(&resend_tasklet);
index 118323bc852982de01c839b4bcbe32e22fbe4105..30ab20623bcafc6861163f11323df8053b3d38be 100644 (file)
@@ -236,7 +236,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode)
         */
        int dumpable = 0;
        /* Don't let security modules deny introspection */
-       if (task == current)
+       if (same_thread_group(task, current))
                return 0;
        rcu_read_lock();
        tcred = __task_cred(task);
index a5457d577b98313b1ca8b1670ad32a2140001498..6ad2e2d320fe403056ee5b93219aa1209a9899e9 100644 (file)
@@ -455,7 +455,7 @@ static int __init ring_buffer_benchmark_init(void)
 
        if (producer_fifo >= 0) {
                struct sched_param param = {
-                       .sched_priority = consumer_fifo
+                       .sched_priority = producer_fifo
                };
                sched_setscheduler(producer, SCHED_FIFO, &param);
        } else
index 79462443658dcb614ec1249d9ab60df32fbbac82..b8a1ac72be4ea430c345fdfd99f6a9991678207f 100644 (file)
@@ -428,6 +428,7 @@ enum {
 
        TRACE_CONTROL_BIT,
 
+       TRACE_BRANCH_BIT,
 /*
  * Abuse of the trace_recursion.
  * As we need a way to maintain state if we are tracing the function
index d594da0dc03ce53db530e238df1d410c4b89e29a..cb89197adf5c4e344a9d03f3b6df47fae6e03a66 100644 (file)
@@ -37,9 +37,12 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
        struct trace_branch *entry;
        struct ring_buffer *buffer;
        unsigned long flags;
-       int cpu, pc;
+       int pc;
        const char *p;
 
+       if (current->trace_recursion & TRACE_BRANCH_BIT)
+               return;
+
        /*
         * I would love to save just the ftrace_likely_data pointer, but
         * this code can also be used by modules. Ugly things can happen
@@ -50,10 +53,10 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
        if (unlikely(!tr))
                return;
 
-       local_irq_save(flags);
-       cpu = raw_smp_processor_id();
-       data = per_cpu_ptr(tr->trace_buffer.data, cpu);
-       if (atomic_inc_return(&data->disabled) != 1)
+       raw_local_irq_save(flags);
+       current->trace_recursion |= TRACE_BRANCH_BIT;
+       data = this_cpu_ptr(tr->trace_buffer.data);
+       if (atomic_read(&data->disabled))
                goto out;
 
        pc = preempt_count();
@@ -82,8 +85,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
                __buffer_unlock_commit(buffer, event);
 
  out:
-       atomic_dec(&data->disabled);
-       local_irq_restore(flags);
+       current->trace_recursion &= ~TRACE_BRANCH_BIT;
+       raw_local_irq_restore(flags);
 }
 
 static inline
index 0a1edc694d67c7f488a04e5bdb15f9594e14606c..67654bb5bc2f53cf190d0bca60327de56efb3709 100644 (file)
@@ -1015,6 +1015,9 @@ static void parse_init(struct filter_parse_state *ps,
 
 static char infix_next(struct filter_parse_state *ps)
 {
+       if (!ps->infix.cnt)
+               return 0;
+
        ps->infix.cnt--;
 
        return ps->infix.string[ps->infix.tail++];
@@ -1030,6 +1033,9 @@ static char infix_peek(struct filter_parse_state *ps)
 
 static void infix_advance(struct filter_parse_state *ps)
 {
+       if (!ps->infix.cnt)
+               return;
+
        ps->infix.cnt--;
        ps->infix.tail++;
 }
@@ -1328,19 +1334,26 @@ static int check_preds(struct filter_parse_state *ps)
 {
        int n_normal_preds = 0, n_logical_preds = 0;
        struct postfix_elt *elt;
+       int cnt = 0;
 
        list_for_each_entry(elt, &ps->postfix, list) {
-               if (elt->op == OP_NONE)
+               if (elt->op == OP_NONE) {
+                       cnt++;
                        continue;
+               }
 
+               cnt--;
                if (elt->op == OP_AND || elt->op == OP_OR) {
                        n_logical_preds++;
                        continue;
                }
                n_normal_preds++;
+               /* all ops should have operands */
+               if (cnt < 0)
+                       break;
        }
 
-       if (!n_normal_preds || n_logical_preds >= n_normal_preds) {
+       if (cnt != 1 || !n_normal_preds || n_logical_preds >= n_normal_preds) {
                parse_error(ps, FILT_ERR_INVALID_FILTER, 0);
                return -EINVAL;
        }
index e5c4ebe586babfa20ff91f646df8a4009bc98076..c0634aa923a6d6a7db26b3a4ead37a780550f54e 100644 (file)
@@ -603,12 +603,12 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
        unsigned a, b;
        int c, old_c, totaldigits;
        const char __user __force *ubuf = (const char __user __force *)buf;
-       int exp_digit, in_range;
+       int at_start, in_range;
 
        totaldigits = c = 0;
        bitmap_zero(maskp, nmaskbits);
        do {
-               exp_digit = 1;
+               at_start = 1;
                in_range = 0;
                a = b = 0;
 
@@ -637,11 +637,10 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
                                break;
 
                        if (c == '-') {
-                               if (exp_digit || in_range)
+                               if (at_start || in_range)
                                        return -EINVAL;
                                b = 0;
                                in_range = 1;
-                               exp_digit = 1;
                                continue;
                        }
 
@@ -651,16 +650,18 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen,
                        b = b * 10 + (c - '0');
                        if (!in_range)
                                a = b;
-                       exp_digit = 0;
+                       at_start = 0;
                        totaldigits++;
                }
                if (!(a <= b))
                        return -EINVAL;
                if (b >= nmaskbits)
                        return -ERANGE;
-               while (a <= b) {
-                       set_bit(a, maskp);
-                       a++;
+               if (!at_start) {
+                       while (a <= b) {
+                               set_bit(a, maskp);
+                               a++;
+                       }
                }
        } while (buflen && c == ',');
        return 0;
index 7c86434d9cfeebdea0e7ed0eee12c2942fa6e10f..50671e5105ab85fc0e908396666e5274c98b0f65 100644 (file)
@@ -3232,6 +3232,10 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
 
        pte_unmap(page_table);
 
+       /* File mapping without ->vm_ops ? */
+       if (vma->vm_flags & VM_SHARED)
+               return VM_FAULT_SIGBUS;
+
        /* Check if we need to add a guard page to the stack */
        if (check_stack_guard_page(vma, address) < 0)
                return VM_FAULT_SIGSEGV;
@@ -3497,6 +3501,9 @@ static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
                        - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
        pte_unmap(page_table);
+       /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */
+       if (!vma->vm_ops->fault)
+               return VM_FAULT_SIGBUS;
        return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte);
 }
 
@@ -3708,11 +3715,9 @@ int handle_pte_fault(struct mm_struct *mm,
        entry = *pte;
        if (!pte_present(entry)) {
                if (pte_none(entry)) {
-                       if (vma->vm_ops) {
-                               if (likely(vma->vm_ops->fault))
-                                       return do_linear_fault(mm, vma, address,
+                       if (vma->vm_ops)
+                               return do_linear_fault(mm, vma, address,
                                                pte, pmd, flags, entry);
-                       }
                        return do_anonymous_page(mm, vma, address,
                                                 pte, pmd, flags);
                }
index 2298237db1429a464c064241a77ada2f61e7552d..d85d3a0e06ce4a5ec97d32b3a36aa2c30177868c 100644 (file)
@@ -1803,8 +1803,10 @@ void try_offline_node(int nid)
                 * wait_table may be allocated from boot memory,
                 * here only free if it's allocated by vmalloc.
                 */
-               if (is_vmalloc_addr(zone->wait_table))
+               if (is_vmalloc_addr(zone->wait_table)) {
                        vfree(zone->wait_table);
+                       zone->wait_table = NULL;
+               }
        }
 }
 EXPORT_SYMBOL(try_offline_node);
index addc116cecf0be16210498b6544fa40ad24cc615..853d62327a58a3c082a863e41109b5a5fee17775 100644 (file)
@@ -828,7 +828,8 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type,
        if (err < 0) {
                if (err == -EIO)
                        c->status = Disconnected;
-               goto reterr;
+               if (err != -ERESTARTSYS)
+                       goto reterr;
        }
        if (req->status == REQ_STATUS_ERROR) {
                p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err);
index cd8c3a44ab7dccbdb82ddb0cba3fe0a8c2e978c0..b73eaba856675d68bf483af0eec30144f212106d 100644 (file)
@@ -247,9 +247,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN))
                        return -EPERM;
 
-               spin_lock_bh(&br->lock);
                br_stp_set_bridge_priority(br, args[1]);
-               spin_unlock_bh(&br->lock);
                return 0;
 
        case BRCTL_SET_PORT_PRIORITY:
index 81de0106528b72be4efb6904d624ee287e5aea7d..a09ea178348c42ec73113113671fe8fb42860ed3 100644 (file)
@@ -1007,7 +1007,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br,
 
                err = br_ip6_multicast_add_group(br, port, &grec->grec_mca,
                                                 vid);
-               if (!err)
+               if (err)
                        break;
        }
 
@@ -1026,6 +1026,9 @@ static void br_multicast_add_router(struct net_bridge *br,
        struct net_bridge_port *p;
        struct hlist_node *slot = NULL;
 
+       if (!hlist_unhashed(&port->rlist))
+               return;
+
        hlist_for_each_entry(p, &br->router_list, rlist) {
                if ((unsigned long) port >= (unsigned long) p)
                        break;
@@ -1053,12 +1056,8 @@ static void br_multicast_mark_router(struct net_bridge *br,
        if (port->multicast_router != 1)
                return;
 
-       if (!hlist_unhashed(&port->rlist))
-               goto timer;
-
        br_multicast_add_router(br, port);
 
-timer:
        mod_timer(&port->multicast_router_timer,
                  now + br->multicast_querier_interval);
 }
index 656a6f3e40de1b13b9ea7a89373da5d5615e5bb2..886f6d6dc48a3f8c2749dc9c04dc422e248c5f35 100644 (file)
@@ -241,12 +241,13 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)
        return true;
 }
 
-/* called under bridge lock */
+/* Acquires and releases bridge lock */
 void br_stp_set_bridge_priority(struct net_bridge *br, u16 newprio)
 {
        struct net_bridge_port *p;
        int wasroot;
 
+       spin_lock_bh(&br->lock);
        wasroot = br_is_root_bridge(br);
 
        list_for_each_entry(p, &br->port_list, list) {
@@ -264,6 +265,7 @@ void br_stp_set_bridge_priority(struct net_bridge *br, u16 newprio)
        br_port_state_selection(br);
        if (br_is_root_bridge(br) && !wasroot)
                br_become_root_bridge(br);
+       spin_unlock_bh(&br->lock);
 }
 
 /* called under bridge lock */
index dbd9a4792427455e0a2dfdd7d2249c4abcbbb798..7ec4e052221519c0a01afa4d504d4d2b6988efdc 100644 (file)
@@ -89,7 +89,7 @@ static int crush_decode_tree_bucket(void **p, void *end,
 {
        int j;
        dout("crush_decode_tree_bucket %p to %p\n", *p, end);
-       ceph_decode_32_safe(p, end, b->num_nodes, bad);
+       ceph_decode_8_safe(p, end, b->num_nodes, bad);
        b->node_weights = kcalloc(b->num_nodes, sizeof(u32), GFP_NOFS);
        if (b->node_weights == NULL)
                return -ENOMEM;
index 577801102a70c799156a4614e942d7a1d071876b..52fceb025a7201abe30d9e03373056da1fc28c88 100644 (file)
@@ -873,6 +873,10 @@ static int ip_error(struct sk_buff *skb)
        bool send;
        int code;
 
+       /* IP on this device is disabled. */
+       if (!in_dev)
+               goto out;
+
        net = dev_net(rt->dst.dev);
        if (!IN_DEV_FORWARD(in_dev)) {
                switch (rt->dst.error) {
index 58c5dbd5fb945aa66720746ebcd4437855fa7dff..b6bcdbec6ce7305a185e461ee05b8e1d50cee2cb 100644 (file)
@@ -1294,10 +1294,8 @@ csum_copy_err:
        }
        unlock_sock_fast(sk, slow);
 
-       if (noblock)
-               return -EAGAIN;
-
-       /* starting over for a new packet */
+       /* starting over for a new packet, but check if we need to yield */
+       cond_resched();
        msg->msg_flags &= ~MSG_TRUNC;
        goto try_again;
 }
index 9a459be24af762b42e2d667618f7149c055e5ef6..9b5b5ddf8cd479fc620ebe987dbf7648f5b15c6f 100644 (file)
@@ -235,7 +235,7 @@ static struct dst_ops xfrm4_dst_ops = {
        .destroy =              xfrm4_dst_destroy,
        .ifdown =               xfrm4_dst_ifdown,
        .local_out =            __ip_local_out,
-       .gc_thresh =            1024,
+       .gc_thresh =            32768,
 };
 
 static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
index ceeb9458bb60c84c83de22f534f77807a1bb8277..46458ee3193939f7975219728ddacd9e6fe78492 100644 (file)
@@ -1648,27 +1648,28 @@ static int fib6_age(struct rt6_info *rt, void *arg)
 
 static DEFINE_SPINLOCK(fib6_gc_lock);
 
-void fib6_run_gc(unsigned long expires, struct net *net)
+void fib6_run_gc(unsigned long expires, struct net *net, bool force)
 {
-       if (expires != ~0UL) {
+       unsigned long now;
+
+       if (force) {
                spin_lock_bh(&fib6_gc_lock);
-               gc_args.timeout = expires ? (int)expires :
-                       net->ipv6.sysctl.ip6_rt_gc_interval;
-       } else {
-               if (!spin_trylock_bh(&fib6_gc_lock)) {
-                       mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ);
-                       return;
-               }
-               gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval;
+       } else if (!spin_trylock_bh(&fib6_gc_lock)) {
+               mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ);
+               return;
        }
+       gc_args.timeout = expires ? (int)expires :
+                         net->ipv6.sysctl.ip6_rt_gc_interval;
 
        gc_args.more = icmp6_dst_gc();
 
        fib6_clean_all(net, fib6_age, 0, NULL);
+       now = jiffies;
+       net->ipv6.ip6_rt_last_gc = now;
 
        if (gc_args.more)
                mod_timer(&net->ipv6.ip6_fib_timer,
-                         round_jiffies(jiffies
+                         round_jiffies(now
                                        + net->ipv6.sysctl.ip6_rt_gc_interval));
        else
                del_timer(&net->ipv6.ip6_fib_timer);
@@ -1677,7 +1678,7 @@ void fib6_run_gc(unsigned long expires, struct net *net)
 
 static void fib6_gc_timer_cb(unsigned long arg)
 {
-       fib6_run_gc(0, (struct net *)arg);
+       fib6_run_gc(0, (struct net *)arg, true);
 }
 
 static int __net_init fib6_net_init(struct net *net)
index 05f361338c2eabd0d27449cd8d85a3c29e19046d..deedf7ddbc6e270500b40974367b72caae0cc6f7 100644 (file)
@@ -1584,7 +1584,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
        switch (event) {
        case NETDEV_CHANGEADDR:
                neigh_changeaddr(&nd_tbl, dev);
-               fib6_run_gc(~0UL, net);
+               fib6_run_gc(0, net, false);
                idev = in6_dev_get(dev);
                if (!idev)
                        break;
@@ -1594,7 +1594,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
                break;
        case NETDEV_DOWN:
                neigh_ifdown(&nd_tbl, dev);
-               fib6_run_gc(~0UL, net);
+               fib6_run_gc(0, net, false);
                break;
        case NETDEV_NOTIFY_PEERS:
                ndisc_send_unsol_na(dev);
index 2f127bd67a5daa3ee7c9e7cdb8519fbbb43005eb..206b70f02696d4c798368b1df430813dab24cbb4 100644 (file)
@@ -1331,7 +1331,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg),
 
 static int ip6_dst_gc(struct dst_ops *ops)
 {
-       unsigned long now = jiffies;
        struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops);
        int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval;
        int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size;
@@ -1341,13 +1340,12 @@ static int ip6_dst_gc(struct dst_ops *ops)
        int entries;
 
        entries = dst_entries_get_fast(ops);
-       if (time_after(rt_last_gc + rt_min_interval, now) &&
+       if (time_after(rt_last_gc + rt_min_interval, jiffies) &&
            entries <= rt_max_size)
                goto out;
 
        net->ipv6.ip6_rt_gc_expire++;
-       fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net);
-       net->ipv6.ip6_rt_last_gc = now;
+       fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size);
        entries = dst_entries_get_slow(ops);
        if (entries < ops->gc_thresh)
                net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1;
@@ -2846,7 +2844,7 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write,
        net = (struct net *)ctl->extra1;
        delay = net->ipv6.sysctl.flush_delay;
        proc_dointvec(ctl, write, buffer, lenp, ppos);
-       fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net);
+       fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0);
        return 0;
 }
 
index e06772c4bccbefc2e9396e1b10171aef9debfe46..32f51133fa22a72f181519040f5d4d389d256ef5 100644 (file)
@@ -496,10 +496,8 @@ csum_copy_err:
        }
        unlock_sock_fast(sk, slow);
 
-       if (noblock)
-               return -EAGAIN;
-
-       /* starting over for a new packet */
+       /* starting over for a new packet, but check if we need to yield */
+       cond_resched();
        msg->msg_flags &= ~MSG_TRUNC;
        goto try_again;
 }
index 23ed03d786c8376cc59f9fa2cf577ee01a4c2c2d..1c2e0c9ba8a19e3dcc10ec4e7f5199bcb7190a86 100644 (file)
@@ -284,7 +284,7 @@ static struct dst_ops xfrm6_dst_ops = {
        .destroy =              xfrm6_dst_destroy,
        .ifdown =               xfrm6_dst_ifdown,
        .local_out =            __ip6_local_out,
-       .gc_thresh =            1024,
+       .gc_thresh =            32768,
 };
 
 static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
index 2d5b4f65c5194b724815ba3ec23be62618364b72..32bafdbdfd668bf0ee8810b553d4450f79b46b1c 100644 (file)
@@ -697,6 +697,7 @@ void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
 
        debugfs_remove_recursive(sdata->vif.debugfs_dir);
        sdata->vif.debugfs_dir = NULL;
+       sdata->debugfs.subdir_stations = NULL;
 }
 
 void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
index 6658c58093533a182323679fb389eb817476d2c3..dd6ca36c34c1f49719261a1eb921499c763c437c 100644 (file)
@@ -257,6 +257,7 @@ static void ieee80211_restart_work(struct work_struct *work)
 {
        struct ieee80211_local *local =
                container_of(work, struct ieee80211_local, restart_work);
+       struct ieee80211_sub_if_data *sdata;
 
        /* wait for scan work complete */
        flush_workqueue(local->workqueue);
@@ -269,6 +270,8 @@ static void ieee80211_restart_work(struct work_struct *work)
        mutex_unlock(&local->mtx);
 
        rtnl_lock();
+       list_for_each_entry(sdata, &local->interfaces, list)
+               flush_delayed_work(&sdata->dec_tailroom_needed_wk);
        ieee80211_scan_cancel(local);
        ieee80211_reconfig(local);
        rtnl_unlock();
index a191b6db657e5e2bd007f6fe342da600d58bf668..3b283edec0273ea9cb1da2ff1729c74d02e8befe 100644 (file)
@@ -74,6 +74,9 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple,
        if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM])
                return -EINVAL;
 
+       /* Not all fields are initialized so first zero the tuple */
+       memset(tuple, 0, sizeof(struct nf_conntrack_tuple));
+
        tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM]));
        tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]);
 
@@ -83,7 +86,7 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple,
 static int
 nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct)
 {
-       const struct nf_conn_help *help = nfct_help(ct);
+       struct nf_conn_help *help = nfct_help(ct);
 
        if (attr == NULL)
                return -EINVAL;
@@ -91,7 +94,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct)
        if (help->helper->data_len == 0)
                return -EINVAL;
 
-       memcpy(&help->data, nla_data(attr), help->helper->data_len);
+       memcpy(help->data, nla_data(attr), help->helper->data_len);
        return 0;
 }
 
index 81b4b816f13132b8bddc1cd3ca28a7bdad835066..39fa33969b09119e33d96e52f09e0e3c8f4568b5 100644 (file)
@@ -1150,16 +1150,6 @@ static void packet_sock_destruct(struct sock *sk)
        sk_refcnt_debug_dec(sk);
 }
 
-static int fanout_rr_next(struct packet_fanout *f, unsigned int num)
-{
-       int x = atomic_read(&f->rr_cur) + 1;
-
-       if (x >= num)
-               x = 0;
-
-       return x;
-}
-
 static unsigned int fanout_demux_hash(struct packet_fanout *f,
                                      struct sk_buff *skb,
                                      unsigned int num)
@@ -1171,13 +1161,9 @@ static unsigned int fanout_demux_lb(struct packet_fanout *f,
                                    struct sk_buff *skb,
                                    unsigned int num)
 {
-       int cur, old;
+       unsigned int val = atomic_inc_return(&f->rr_cur);
 
-       cur = atomic_read(&f->rr_cur);
-       while ((old = atomic_cmpxchg(&f->rr_cur, cur,
-                                    fanout_rr_next(f, num))) != cur)
-               cur = old;
-       return cur;
+       return val % num;
 }
 
 static unsigned int fanout_demux_cpu(struct packet_fanout *f,
@@ -1217,7 +1203,7 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev,
                             struct packet_type *pt, struct net_device *orig_dev)
 {
        struct packet_fanout *f = pt->af_packet_priv;
-       unsigned int num = f->num_members;
+       unsigned int num = ACCESS_ONCE(f->num_members);
        struct packet_sock *po;
        unsigned int idx;
 
index e8fdb172adbb23940b8d2d698cd72fa216cd6ba1..a985158d95d555b4a1db68c19a39459fde9eda12 100644 (file)
@@ -759,8 +759,10 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
        }
 
        ibmr = rds_ib_alloc_fmr(rds_ibdev);
-       if (IS_ERR(ibmr))
+       if (IS_ERR(ibmr)) {
+               rds_ib_dev_put(rds_ibdev);
                return ibmr;
+       }
 
        ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents);
        if (ret == 0)
index 2d2f07945c85a3324275bfbe61f4faf6ccd242ad..e87b27c7bffd6e469afebc45d48c3a972426bbb7 100644 (file)
@@ -752,10 +752,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
                if (dev->flags & IFF_UP)
                        dev_deactivate(dev);
 
-               if (new && new->ops->attach) {
-                       new->ops->attach(new);
-                       num_q = 0;
-               }
+               if (new && new->ops->attach)
+                       goto skip;
 
                for (i = 0; i < num_q; i++) {
                        struct netdev_queue *dev_queue = dev_ingress_queue(dev);
@@ -771,12 +769,16 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
                                qdisc_destroy(old);
                }
 
+skip:
                if (!ingress) {
                        notify_and_destroy(net, skb, n, classid,
                                           dev->qdisc, new);
                        if (new && !new->ops->attach)
                                atomic_inc(&new->refcnt);
                        dev->qdisc = new ? : &noop_qdisc;
+
+                       if (new && new->ops->attach)
+                               new->ops->attach(new);
                } else {
                        notify_and_destroy(net, skb, n, classid, old, new);
                }
index 73b8ca51ba14ffa3fecf138bf2953b7de2581489..2d9689333fe402064543849766093e154c579138 100644 (file)
@@ -618,7 +618,9 @@ out:
        return err;
 no_route:
        kfree_skb(nskb);
-       IP_INC_STATS(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES);
+
+       if (asoc)
+               IP_INC_STATS(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES);
 
        /* FIXME: Returning the 'err' will effect all the associations
         * associated with a socket, although only one of the paths of the
index 890a29912d5ab3f39d156891d4844ede04d367e8..d29c119ecd9cd954e08369cdb8e5caf917549555 100644 (file)
@@ -60,7 +60,7 @@ static void xprt_free_allocation(struct rpc_rqst *req)
 
        dprintk("RPC:        free allocations for req= %p\n", req);
        WARN_ON_ONCE(test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state));
-       xbufp = &req->rq_private_buf;
+       xbufp = &req->rq_rcv_buf;
        free_page((unsigned long)xbufp->head[0].iov_base);
        xbufp = &req->rq_snd_buf;
        free_page((unsigned long)xbufp->head[0].iov_base);
index d997d0f0c54a683fb0aee287d44fc79d4b15230d..18a7a7b112ef6e06f7a9e19da0fc919ae88c9cf6 100644 (file)
@@ -1345,6 +1345,8 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
        memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
        wdev_unlock(wdev);
 
+       memset(&sinfo, 0, sizeof(sinfo));
+
        if (rdev_get_station(rdev, dev, bssid, &sinfo))
                return NULL;
 
index 444019696f8503cf5d51e258c771f9cdf229631f..d30252e7f3e816f78dc76bd981067388e8a0450a 100644 (file)
@@ -2148,6 +2148,7 @@ static const struct hda_fixup alc882_fixups[] = {
 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
        SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
+       SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
        SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
        SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
        SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
@@ -2203,7 +2204,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
        SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
        SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
-       SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
+       SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
 
        SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
        SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
@@ -3364,6 +3365,7 @@ enum {
        ALC269_FIXUP_LIFEBOOK,
        ALC269_FIXUP_LIFEBOOK_EXTMIC,
        ALC269_FIXUP_LIFEBOOK_HP_PIN,
+       ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
        ALC269_FIXUP_AMIC,
        ALC269_FIXUP_DMIC,
        ALC269VB_FIXUP_AMIC,
@@ -3382,6 +3384,7 @@ enum {
        ALC290_FIXUP_MONO_SPEAKERS,
        ALC269_FIXUP_HEADSET_MODE,
        ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
+       ALC269_FIXUP_ASPIRE_HEADSET_MIC,
        ALC269_FIXUP_ASUS_X101_FUNC,
        ALC269_FIXUP_ASUS_X101_VERB,
        ALC269_FIXUP_ASUS_X101,
@@ -3485,6 +3488,10 @@ static const struct hda_fixup alc269_fixups[] = {
                        { }
                },
        },
+       [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
+       },
        [ALC269_FIXUP_AMIC] = {
                .type = HDA_FIXUP_PINS,
                .v.pins = (const struct hda_pintbl[]) {
@@ -3597,6 +3604,15 @@ static const struct hda_fixup alc269_fixups[] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc_fixup_headset_mode_no_hp_mic,
        },
+       [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC269_FIXUP_HEADSET_MODE,
+       },
        [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
                .type = HDA_FIXUP_PINS,
                .v.pins = (const struct hda_pintbl[]) {
@@ -3731,10 +3747,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
        SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
        SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
+       SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
        SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
        SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
        SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
        SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
+       SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
        SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
        SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
        SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
index 2f167a8ca01b507cb3b61521de5db174b186b073..62bacb8536e6ea03d06bfe70ba53119857893bd6 100644 (file)
@@ -494,7 +494,8 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec,
 
                        /* Fast VMID ramp at 2*2.5k */
                        snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL,
-                                           WM8737_VMIDSEL_MASK, 0x4);
+                                           WM8737_VMIDSEL_MASK,
+                                           2 << WM8737_VMIDSEL_SHIFT);
 
                        /* Bring VMID up */
                        snd_soc_update_bits(codec, WM8737_POWER_MANAGEMENT,
@@ -508,7 +509,8 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec,
 
                /* VMID at 2*300k */
                snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL,
-                                   WM8737_VMIDSEL_MASK, 2);
+                                   WM8737_VMIDSEL_MASK,
+                                   1 << WM8737_VMIDSEL_SHIFT);
 
                break;
 
index db949311c0f206c401f70839a4f318f3fc8557e4..0bb4a647755d84c88a2edddd29da26dae6aa95ac 100644 (file)
@@ -172,7 +172,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec,
 #define WM8903_VMID_BUF_ENA_WIDTH                    1  /* VMID_BUF_ENA */
 
 #define WM8903_VMID_RES_50K                          2
-#define WM8903_VMID_RES_250K                         3
+#define WM8903_VMID_RES_250K                         4
 #define WM8903_VMID_RES_5K                           6
 
 /*
index 1c1fc6119758e993f3c381137978f7295ec40082..475fc24c8ff6302642004bf12f3a63eaa1c757d5 100644 (file)
@@ -298,7 +298,7 @@ static int wm8955_configure_clocking(struct snd_soc_codec *codec)
                snd_soc_update_bits(codec, WM8955_PLL_CONTROL_2,
                                    WM8955_K_17_9_MASK,
                                    (pll.k >> 9) & WM8955_K_17_9_MASK);
-               snd_soc_update_bits(codec, WM8955_PLL_CONTROL_2,
+               snd_soc_update_bits(codec, WM8955_PLL_CONTROL_3,
                                    WM8955_K_8_0_MASK,
                                    pll.k & WM8955_K_8_0_MASK);
                if (pll.k)
index 39f65bc9de5617c3bb6df59b049660ea98bf1970..ae5bb95df8623f97eb283bc4e43ff73a33d2fed9 100644 (file)
@@ -242,7 +242,7 @@ SOC_SINGLE("PCM Playback -6dB Switch", WM8960_DACCTL1, 7, 1, 0),
 SOC_ENUM("ADC Polarity", wm8960_enum[0]),
 SOC_SINGLE("ADC High Pass Filter Switch", WM8960_DACCTL1, 0, 1, 0),
 
-SOC_ENUM("DAC Polarity", wm8960_enum[2]),
+SOC_ENUM("DAC Polarity", wm8960_enum[1]),
 SOC_SINGLE_BOOL_EXT("DAC Deemphasis Switch", 0,
                    wm8960_get_deemph, wm8960_put_deemph),
 
index 061be0e5fa5ade0a2ee05ec5372b416bd73e42c5..5ea5a18f3f58799258c4c971dc49e79234ad28b0 100644 (file)
@@ -891,6 +891,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
        case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */
        case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */
        case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */
+       case USB_ID(0x046d, 0x08ca): /* Logitech Quickcam Fusion */
        case USB_ID(0x046d, 0x0991):
        /* Most audio usb devices lie about volume resolution.
         * Most Logitech webcams have res = 384.
index 4df31b0f94a3731b0c1ccb40ba81d6b5c52c732a..2d17f40fb16d715324d9c8fd28bee91cd8039409 100644 (file)
@@ -330,6 +330,20 @@ static const struct usbmix_name_map scms_usb3318_map[] = {
        { 0 }
 };
 
+/* Bose companion 5, the dB conversion factor is 16 instead of 256 */
+static struct usbmix_dB_map bose_companion5_dB = {-5006, -6};
+static struct usbmix_name_map bose_companion5_map[] = {
+       { 3, NULL, .dB = &bose_companion5_dB },
+       { 0 }   /* terminator */
+};
+
+/* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */
+static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000};
+static struct usbmix_name_map dragonfly_1_2_map[] = {
+       { 7, NULL, .dB = &dragonfly_1_2_dB },
+       { 0 }   /* terminator */
+};
+
 /*
  * Control map entries
  */
@@ -417,6 +431,11 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
                .id = USB_ID(0x200c, 0x1018),
                .map = ebox44_map,
        },
+       {
+               /* MAYA44 USB+ */
+               .id = USB_ID(0x2573, 0x0008),
+               .map = maya44_map,
+       },
        {
                /* KEF X300A */
                .id = USB_ID(0x27ac, 0x1000),
@@ -427,6 +446,16 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
                .id = USB_ID(0x25c4, 0x0003),
                .map = scms_usb3318_map,
        },
+       {
+               /* Bose Companion 5 */
+               .id = USB_ID(0x05a7, 0x1020),
+               .map = bose_companion5_map,
+       },
+       {
+               /* Dragonfly DAC 1.2 */
+               .id = USB_ID(0x21b4, 0x0081),
+               .map = dragonfly_1_2_map,
+       },
        { 0 } /* terminator */
 };
 
index d5bed1d2571384922241d1e670e288c1805c177d..45d586b6e8b533f817d9744fd2910a3b2df7993d 100644 (file)
@@ -2773,6 +2773,74 @@ YAMAHA_DEVICE(0x7010, "UB99"),
        }
 },
 
+/* Steinberg devices */
+{
+       /* Steinberg MI2 */
+       USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x2040),
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+               .ifnum = QUIRK_ANY_INTERFACE,
+               .type = QUIRK_COMPOSITE,
+               .data = & (const struct snd_usb_audio_quirk[]) {
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_STANDARD_INTERFACE
+                       },
+                       {
+                               .ifnum = 1,
+                               .type = QUIRK_AUDIO_STANDARD_INTERFACE
+                       },
+                       {
+                               .ifnum = 2,
+                               .type = QUIRK_AUDIO_STANDARD_INTERFACE
+                       },
+                       {
+                               .ifnum = 3,
+                               .type = QUIRK_MIDI_FIXED_ENDPOINT,
+                               .data = &(const struct snd_usb_midi_endpoint_info) {
+                                       .out_cables = 0x0001,
+                                       .in_cables  = 0x0001
+                               }
+                       },
+                       {
+                               .ifnum = -1
+                       }
+               }
+       }
+},
+{
+       /* Steinberg MI4 */
+       USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x4040),
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+               .ifnum = QUIRK_ANY_INTERFACE,
+               .type = QUIRK_COMPOSITE,
+               .data = & (const struct snd_usb_audio_quirk[]) {
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_STANDARD_INTERFACE
+                       },
+                       {
+                               .ifnum = 1,
+                               .type = QUIRK_AUDIO_STANDARD_INTERFACE
+                       },
+                       {
+                               .ifnum = 2,
+                               .type = QUIRK_AUDIO_STANDARD_INTERFACE
+                       },
+                       {
+                               .ifnum = 3,
+                               .type = QUIRK_MIDI_FIXED_ENDPOINT,
+                               .data = &(const struct snd_usb_midi_endpoint_info) {
+                                       .out_cables = 0x0001,
+                                       .in_cables  = 0x0001
+                               }
+                       },
+                       {
+                               .ifnum = -1
+                       }
+               }
+       }
+},
+
 /* TerraTec devices */
 {
        USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012),