Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
authorAlex Shi <alex.shi@linaro.org>
Tue, 10 Jan 2017 04:01:14 +0000 (12:01 +0800)
committerAlex Shi <alex.shi@linaro.org>
Tue, 10 Jan 2017 04:01:14 +0000 (12:01 +0800)
78 files changed:
Documentation/virtual/kvm/api.txt
Makefile
arch/arc/include/asm/cacheflush.h
arch/arc/mm/cache.c
arch/powerpc/boot/ps3-head.S
arch/powerpc/boot/ps3.c
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/include/uapi/asm/kvm.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/idle_power7.S
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_rm_mmu.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S
arch/x86/entry/entry_32.S
arch/x86/kvm/vmx.c
block/bsg.c
drivers/acpi/video_detect.c
drivers/base/firmware_class.c
drivers/clk/bcm/clk-bcm2835.c
drivers/gpu/drm/ast/ast_main.c
drivers/gpu/drm/gma500/psb_drv.c
drivers/gpu/drm/nouveau/nouveau_bios.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogf100.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifogk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c
drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowacpi.c
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c
drivers/gpu/drm/radeon/radeon_cursor.c
drivers/gpu/drm/radeon/radeon_mode.h
drivers/gpu/drm/radeon/si_dpm.c
drivers/infiniband/core/mad.c
drivers/infiniband/core/multicast.c
drivers/infiniband/ulp/ipoib/ipoib_multicast.c
drivers/input/misc/drv260x.c
drivers/md/raid5.c
drivers/media/pci/solo6x10/solo6x10.h
drivers/misc/mei/client.c
drivers/mmc/host/sdhci.c
drivers/net/ethernet/marvell/mvpp2.c
drivers/net/wireless/ath/ath9k/pci.c
drivers/net/wireless/realtek/rtlwifi/base.c
drivers/net/wireless/realtek/rtlwifi/core.c
drivers/net/wireless/realtek/rtlwifi/pci.c
drivers/net/wireless/realtek/rtlwifi/ps.c
drivers/pci/pci.c
drivers/platform/x86/asus-nb-wmi.c
drivers/regulator/stw481x-vmmc.c
drivers/s390/char/vmlogrdr.c
drivers/s390/scsi/zfcp_dbf.c
drivers/s390/scsi/zfcp_dbf.h
drivers/s390/scsi/zfcp_erp.c
drivers/s390/scsi/zfcp_ext.h
drivers/s390/scsi/zfcp_fsf.h
drivers/s390/scsi/zfcp_reqlist.h
drivers/s390/scsi/zfcp_scsi.c
drivers/scsi/megaraid/megaraid_sas_fusion.c
drivers/scsi/scsi_sysfs.c
drivers/scsi/sg.c
drivers/ssb/pci.c
drivers/staging/comedi/drivers/ni_mio_common.c
drivers/target/target_core_user.c
drivers/thermal/thermal_hwmon.c
drivers/tty/serial/sc16is7xx.c
drivers/tty/vt/keyboard.c
fs/block_dev.c
fs/nfs/file.c
include/net/cfg80211.h
include/rdma/ib_addr.h
kernel/time/timekeeping.c
kernel/trace/trace_functions_graph.c
net/ceph/messenger.c
net/mac80211/mlme.c
net/wireless/core.h
net/wireless/mlme.c
net/wireless/sme.c
scripts/kconfig/nconf.gui.c

index 092ee9fbaf2bdc15868475267e5875727a62841f..df8ab4fc240a0c0d98d363c05f9120d9a894b306 100644 (file)
@@ -1991,6 +1991,7 @@ registers, find a list below:
   PPC   | KVM_REG_PPC_TM_VSCR           | 32
   PPC   | KVM_REG_PPC_TM_DSCR           | 64
   PPC   | KVM_REG_PPC_TM_TAR            | 64
+  PPC   | KVM_REG_PPC_TM_XER            | 64
         |                               |
   MIPS  | KVM_REG_MIPS_R0               | 64
           ...
index 5b5937780408cf7bfb25e2a6996000d6dbee25f8..855e71066174af4ff66bd81a004dd3c00d731e0b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 40
+SUBLEVEL = 41
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
index fbe3587c4f36f1add284667fd8a04edbe90ea2ef..56aeb5efe6042329bd6d27cf54faaa6cb9f16334 100644 (file)
@@ -85,6 +85,10 @@ void flush_anon_page(struct vm_area_struct *vma,
  */
 #define PG_dc_clean    PG_arch_1
 
+#define CACHE_COLORS_NUM       4
+#define CACHE_COLORS_MSK       (CACHE_COLORS_NUM - 1)
+#define CACHE_COLOR(addr)      (((unsigned long)(addr) >> (PAGE_SHIFT)) & CACHE_COLORS_MSK)
+
 /*
  * Simple wrapper over config option
  * Bootup code ensures that hardware matches kernel configuration
@@ -94,8 +98,6 @@ static inline int cache_is_vipt_aliasing(void)
        return IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING);
 }
 
-#define CACHE_COLOR(addr)      (((unsigned long)(addr) >> (PAGE_SHIFT)) & 1)
-
 /*
  * checks if two addresses (after page aligning) index into same cache set
  */
index aaf1e2d1d9003c01b7040a611488dcb9d24d3d3e..d81b6d7e11e79d64b34de28acc798ceaf6a2d1b5 100644 (file)
@@ -960,11 +960,16 @@ void arc_cache_init(void)
                /* check for D-Cache aliasing on ARCompact: ARCv2 has PIPT */
                if (is_isa_arcompact()) {
                        int handled = IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING);
-
-                       if (dc->alias && !handled)
-                               panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n");
-                       else if (!dc->alias && handled)
+                       int num_colors = dc->sz_k/dc->assoc/TO_KB(PAGE_SIZE);
+
+                       if (dc->alias) {
+                               if (!handled)
+                                       panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n");
+                               if (CACHE_COLORS_NUM != num_colors)
+                                       panic("CACHE_COLORS_NUM not optimized for config\n");
+                       } else if (!dc->alias && handled) {
                                panic("Disable CONFIG_ARC_CACHE_VIPT_ALIASING\n");
+                       }
                }
        }
 
index b6fcbaf5027bedc23c6da663b79453b08f5be4f2..3dc44b05fb9724a9d2761233c6d4bad54c6258cc 100644 (file)
@@ -57,11 +57,6 @@ __system_reset_overlay:
        bctr
 
 1:
-       /* Save the value at addr zero for a null pointer write check later. */
-
-       li      r4, 0
-       lwz     r3, 0(r4)
-
        /* Primary delays then goes to _zimage_start in wrapper. */
 
        or      31, 31, 31 /* db16cyc */
index 4ec2d86d3c50571a2a62f27c31f00739595ed219..a05558a7e51ad3b2698e8cf6f1acb8922ff5bfa0 100644 (file)
@@ -119,13 +119,12 @@ void ps3_copy_vectors(void)
        flush_cache((void *)0x100, 512);
 }
 
-void platform_init(unsigned long null_check)
+void platform_init(void)
 {
        const u32 heapsize = 0x1000000 - (u32)_end; /* 16MiB */
        void *chosen;
        unsigned long ft_addr;
        u64 rm_size;
-       unsigned long val;
 
        console_ops.write = ps3_console_write;
        platform_ops.exit = ps3_exit;
@@ -153,11 +152,6 @@ void platform_init(unsigned long null_check)
 
        printf(" flat tree at 0x%lx\n\r", ft_addr);
 
-       val = *(unsigned long *)0;
-
-       if (val != null_check)
-               printf("null check failed: %lx != %lx\n\r", val, null_check);
-
        ((kernel_entry_t)0)(ft_addr, 0, NULL);
 
        ps3_exit();
index cfa758c6b4f6b639c686026966d73a4b4dcaff3b..a92d95aee42dd81743b99fa3d36ce0abcf6b9f57 100644 (file)
@@ -545,6 +545,7 @@ struct kvm_vcpu_arch {
        u64 tfiar;
 
        u32 cr_tm;
+       u64 xer_tm;
        u64 lr_tm;
        u64 ctr_tm;
        u64 amr_tm;
index ab4d4732c492ebc4dd9514733cbb8461af0dbf87..720b71a636c851739adc2e88a4fc2de024ecf7b8 100644 (file)
@@ -587,6 +587,7 @@ struct kvm_get_htab_header {
 #define KVM_REG_PPC_TM_VSCR    (KVM_REG_PPC_TM | KVM_REG_SIZE_U32 | 0x67)
 #define KVM_REG_PPC_TM_DSCR    (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x68)
 #define KVM_REG_PPC_TM_TAR     (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x69)
+#define KVM_REG_PPC_TM_XER     (KVM_REG_PPC_TM | KVM_REG_SIZE_U64 | 0x6a)
 
 /* PPC64 eXternal Interrupt Controller Specification */
 #define KVM_DEV_XICS_GRP_SOURCES       1       /* 64-bit source attributes */
index 221d584d089f9418abfa1087cffd9d0b0117c090..40da69163d5141c0c00812fac2bc82bbe6f482fb 100644 (file)
@@ -584,6 +584,7 @@ int main(void)
        DEFINE(VCPU_VRS_TM, offsetof(struct kvm_vcpu, arch.vr_tm.vr));
        DEFINE(VCPU_VRSAVE_TM, offsetof(struct kvm_vcpu, arch.vrsave_tm));
        DEFINE(VCPU_CR_TM, offsetof(struct kvm_vcpu, arch.cr_tm));
+       DEFINE(VCPU_XER_TM, offsetof(struct kvm_vcpu, arch.xer_tm));
        DEFINE(VCPU_LR_TM, offsetof(struct kvm_vcpu, arch.lr_tm));
        DEFINE(VCPU_CTR_TM, offsetof(struct kvm_vcpu, arch.ctr_tm));
        DEFINE(VCPU_AMR_TM, offsetof(struct kvm_vcpu, arch.amr_tm));
index 112ccf4975620f899a4747c98a13cd09260b5598..73f638789a38a520fea98819023b36f1da20b1c1 100644 (file)
@@ -44,7 +44,7 @@
        std     r0,0(r1);                                       \
        ptesync;                                                \
        ld      r0,0(r1);                                       \
-1:     cmp     cr0,r0,r0;                                      \
+1:     cmpd    cr0,r0,r0;                                      \
        bne     1b;                                             \
        IDLE_INST;                                              \
        b       .
index a7352b59e6f9b5c74f37556e6858c9ac9c5bb30b..3c3a367b6e59d609d63880f87eab399be749f371 100644 (file)
@@ -1186,6 +1186,9 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
        case KVM_REG_PPC_TM_CR:
                *val = get_reg_val(id, vcpu->arch.cr_tm);
                break;
+       case KVM_REG_PPC_TM_XER:
+               *val = get_reg_val(id, vcpu->arch.xer_tm);
+               break;
        case KVM_REG_PPC_TM_LR:
                *val = get_reg_val(id, vcpu->arch.lr_tm);
                break;
@@ -1393,6 +1396,9 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
        case KVM_REG_PPC_TM_CR:
                vcpu->arch.cr_tm = set_reg_val(id, *val);
                break;
+       case KVM_REG_PPC_TM_XER:
+               vcpu->arch.xer_tm = set_reg_val(id, *val);
+               break;
        case KVM_REG_PPC_TM_LR:
                vcpu->arch.lr_tm = set_reg_val(id, *val);
                break;
index 91700518bbf30491be41c8feebeb0d9df1329529..d509ff5c87b01c9ac0c8f64a6248325b4651fcd9 100644 (file)
@@ -653,6 +653,8 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
                                              HPTE_V_ABSENT);
                        do_tlbies(kvm, &rb, 1, global_invalidates(kvm, flags),
                                  true);
+                       /* Don't lose R/C bit updates done by hardware */
+                       r |= be64_to_cpu(hpte[1]) & (HPTE_R_R | HPTE_R_C);
                        hpte[1] = cpu_to_be64(r);
                }
        }
index 974f73df00bbf1533458ad3e713cacd5349c78fb..1a743f87b37d08849e552a4040dbb7fc2e4e6005 100644 (file)
@@ -2514,11 +2514,13 @@ kvmppc_save_tm:
        mfctr   r7
        mfspr   r8, SPRN_AMR
        mfspr   r10, SPRN_TAR
+       mfxer   r11
        std     r5, VCPU_LR_TM(r9)
        stw     r6, VCPU_CR_TM(r9)
        std     r7, VCPU_CTR_TM(r9)
        std     r8, VCPU_AMR_TM(r9)
        std     r10, VCPU_TAR_TM(r9)
+       std     r11, VCPU_XER_TM(r9)
 
        /* Restore r12 as trap number. */
        lwz     r12, VCPU_TRAP(r9)
@@ -2611,11 +2613,13 @@ kvmppc_restore_tm:
        ld      r7, VCPU_CTR_TM(r4)
        ld      r8, VCPU_AMR_TM(r4)
        ld      r9, VCPU_TAR_TM(r4)
+       ld      r10, VCPU_XER_TM(r4)
        mtlr    r5
        mtcr    r6
        mtctr   r7
        mtspr   SPRN_AMR, r8
        mtspr   SPRN_TAR, r9
+       mtxer   r10
 
        /*
         * Load up PPR and DSCR values but don't put them in the actual SPRs
index f3b6d54e0042b7f08c25a82283f88e8193c70c4a..ae678ad128a94d2e945c15a85e9553bb1df9edd6 100644 (file)
@@ -766,8 +766,8 @@ ftrace_graph_call:
        jmp     ftrace_stub
 #endif
 
-.globl ftrace_stub
-ftrace_stub:
+/* This is weak to keep gas from relaxing the jumps */
+WEAK(ftrace_stub)
        ret
 END(ftrace_caller)
 
index 268df707b5ce8f5d7739e3d23c7ab48f8085941a..bb620df05d0dca09fd07cc041935a834efe48dd9 100644 (file)
@@ -1247,10 +1247,10 @@ static inline bool nested_cpu_has_posted_intr(struct vmcs12 *vmcs12)
        return vmcs12->pin_based_vm_exec_control & PIN_BASED_POSTED_INTR;
 }
 
-static inline bool is_exception(u32 intr_info)
+static inline bool is_nmi(u32 intr_info)
 {
        return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK))
-               == (INTR_TYPE_HARD_EXCEPTION | INTR_INFO_VALID_MASK);
+               == (INTR_TYPE_NMI_INTR | INTR_INFO_VALID_MASK);
 }
 
 static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
@@ -5234,7 +5234,7 @@ static int handle_exception(struct kvm_vcpu *vcpu)
        if (is_machine_check(intr_info))
                return handle_machine_check(vcpu);
 
-       if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)
+       if (is_nmi(intr_info))
                return 1;  /* already handled by vmx_vcpu_run() */
 
        if (is_no_device(intr_info)) {
@@ -7722,7 +7722,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
 
        switch (exit_reason) {
        case EXIT_REASON_EXCEPTION_NMI:
-               if (!is_exception(intr_info))
+               if (is_nmi(intr_info))
                        return false;
                else if (is_page_fault(intr_info))
                        return enable_ept;
@@ -8329,8 +8329,7 @@ static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx)
                kvm_machine_check();
 
        /* We need to handle NMIs before interrupts are enabled */
-       if ((exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
-           (exit_intr_info & INTR_INFO_VALID_MASK)) {
+       if (is_nmi(exit_intr_info)) {
                kvm_before_handle_nmi(&vmx->vcpu);
                asm("int $2");
                kvm_after_handle_nmi(&vmx->vcpu);
index d214e929ce1855bb653808f03482580b45b5344e..b9a53615bdef4945748057e5efbfef56c5cb4847 100644 (file)
@@ -655,6 +655,9 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 
        dprintk("%s: write %Zd bytes\n", bd->name, count);
 
+       if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
+               return -EINVAL;
+
        bsg_set_block(bd, file);
 
        bytes_written = 0;
index 80e55cb0827ba914751dca3140f2d04ca64ca6a6..b48ecbfc4498890be2de685f6a52bf27badb0904 100644 (file)
@@ -271,6 +271,26 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
                DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"),
                },
        },
+       {
+        /* https://bugzilla.redhat.com/show_bug.cgi?id=1123661 */
+        .callback = video_detect_force_native,
+        .ident = "Dell XPS 17 L702X",
+        .matches = {
+               DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+               DMI_MATCH(DMI_PRODUCT_NAME, "Dell System XPS L702X"),
+               },
+       },
+       {
+       /* https://bugzilla.redhat.com/show_bug.cgi?id=1204476 */
+       /* https://bugs.launchpad.net/ubuntu/+source/linux-lts-trusty/+bug/1416940 */
+       .callback = video_detect_force_native,
+       .ident = "HP Pavilion dv6",
+       .matches = {
+               DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
+               DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv6 Notebook PC"),
+               },
+       },
+
        { },
 };
 
index 8524450e75bd15d8f97327af84662b4af32fc3a7..ccfd268148a8f5fc0ee0b2642d63267ef12a51aa 100644 (file)
@@ -942,13 +942,14 @@ static int _request_firmware_load(struct firmware_priv *fw_priv,
                timeout = MAX_JIFFY_OFFSET;
        }
 
-       retval = wait_for_completion_interruptible_timeout(&buf->completion,
+       timeout = wait_for_completion_interruptible_timeout(&buf->completion,
                        timeout);
-       if (retval == -ERESTARTSYS || !retval) {
+       if (timeout == -ERESTARTSYS || !timeout) {
+               retval = timeout;
                mutex_lock(&fw_lock);
                fw_load_abort(fw_priv);
                mutex_unlock(&fw_lock);
-       } else if (retval > 0) {
+       } else if (timeout > 0) {
                retval = 0;
        }
 
index 6029313aa99586b3088de8ca82e66dd0e0752b70..35ab89fe9d7b126a436c992b5f98b15b21c06b4a 100644 (file)
@@ -1082,7 +1082,9 @@ static void bcm2835_pll_divider_off(struct clk_hw *hw)
        cprman_write(cprman, data->cm_reg,
                     (cprman_read(cprman, data->cm_reg) &
                      ~data->load_mask) | data->hold_mask);
-       cprman_write(cprman, data->a2w_reg, A2W_PLL_CHANNEL_DISABLE);
+       cprman_write(cprman, data->a2w_reg,
+                    cprman_read(cprman, data->a2w_reg) |
+                    A2W_PLL_CHANNEL_DISABLE);
        spin_unlock(&cprman->regs_lock);
 }
 
index e0b4586a26fde79d7a9eb6dbc506c8cc11d85996..9b8f0b975ca6ce6dd711e080186c34e868088d9e 100644 (file)
@@ -223,7 +223,8 @@ static int ast_get_dram_info(struct drm_device *dev)
        ast_write32(ast, 0x10000, 0xfc600309);
 
        do {
-               ;
+               if (pci_channel_offline(dev->pdev))
+                       return -EIO;
        } while (ast_read32(ast, 0x10000) != 0x01);
        data = ast_read32(ast, 0x10004);
 
@@ -429,7 +430,9 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags)
        ast_detect_chip(dev, &need_post);
 
        if (ast->chip != AST1180) {
-               ast_get_dram_info(dev);
+               ret = ast_get_dram_info(dev);
+               if (ret)
+                       goto out_free;
                ast->vram_size = ast_get_vram_info(dev);
                DRM_INFO("dram %d %d %d %08x\n", ast->mclk, ast->dram_type, ast->dram_bus_width, ast->vram_size);
        }
index 92e7e5795398e80a6ab46f51d3aad4d22a4e8346..db98ab5cde3d86f04603615013466281b9fd7e40 100644 (file)
@@ -484,6 +484,9 @@ static const struct file_operations psb_gem_fops = {
        .open = drm_open,
        .release = drm_release,
        .unlocked_ioctl = psb_unlocked_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl = drm_compat_ioctl,
+#endif
        .mmap = drm_gem_mmap,
        .poll = drm_poll,
        .read = drm_read,
index 4dca65a63b9226fa17c64452feff876b8faebd45..af224fafa21f4655e5433084457684445a0d3103 100644 (file)
@@ -333,6 +333,9 @@ get_fp_strap(struct drm_device *dev, struct nvbios *bios)
        if (bios->major_version < 5 && bios->data[0x48] & 0x4)
                return NVReadVgaCrtc5758(dev, 0, 0xf) & 0xf;
 
+       if (drm->device.info.family >= NV_DEVICE_INFO_V0_MAXWELL)
+               return nvif_rd32(device, 0x001800) & 0x0000000f;
+       else
        if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA)
                return (nvif_rd32(device, NV_PEXTDEV_BOOT_0) >> 24) & 0xf;
        else
index bbc9824af6e037e01bfb60cae32d1a801e8b095f..ece9f4102c0e2cc5ca199cf853fb2706c9ede536 100644 (file)
@@ -1833,7 +1833,7 @@ nvf1_chipset = {
        .fb = gk104_fb_new,
        .fuse = gf100_fuse_new,
        .gpio = gk104_gpio_new,
-       .i2c = gf119_i2c_new,
+       .i2c = gk104_i2c_new,
        .ibus = gk104_ibus_new,
        .imem = nv50_instmem_new,
        .ltc = gk104_ltc_new,
@@ -1941,7 +1941,7 @@ nv117_chipset = {
        .fb = gm107_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
-       .i2c = gf119_i2c_new,
+       .i2c = gk104_i2c_new,
        .ibus = gk104_ibus_new,
        .imem = nv50_instmem_new,
        .ltc = gm107_ltc_new,
index e7cbc139c1d4fb831bdf7a1a47f649c45ce121a0..89976ff4b305e401a0e921128337166759695297 100644 (file)
@@ -59,6 +59,7 @@ gf100_fifo_gpfifo_engine_fini(struct nvkm_fifo_chan *base,
        struct nvkm_gpuobj *inst = chan->base.inst;
        int ret = 0;
 
+       mutex_lock(&subdev->mutex);
        nvkm_wr32(device, 0x002634, chan->base.chid);
        if (nvkm_msec(device, 2000,
                if (nvkm_rd32(device, 0x002634) == chan->base.chid)
@@ -66,10 +67,12 @@ gf100_fifo_gpfifo_engine_fini(struct nvkm_fifo_chan *base,
        ) < 0) {
                nvkm_error(subdev, "channel %d [%s] kick timeout\n",
                           chan->base.chid, chan->base.object.client->name);
-               ret = -EBUSY;
-               if (suspend)
-                       return ret;
+               ret = -ETIMEDOUT;
        }
+       mutex_unlock(&subdev->mutex);
+
+       if (ret && suspend)
+               return ret;
 
        if (offset) {
                nvkm_kmap(inst);
index 0b817540a9e4f7d62a50aacf0a38d0d06c447abe..aa1692e5669fc39361c232f3db2969b720ad6ae4 100644 (file)
@@ -39,7 +39,9 @@ gk104_fifo_gpfifo_kick(struct gk104_fifo_chan *chan)
        struct nvkm_subdev *subdev = &fifo->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        struct nvkm_client *client = chan->base.object.client;
+       int ret = 0;
 
+       mutex_lock(&subdev->mutex);
        nvkm_wr32(device, 0x002634, chan->base.chid);
        if (nvkm_msec(device, 2000,
                if (!(nvkm_rd32(device, 0x002634) & 0x00100000))
@@ -47,10 +49,10 @@ gk104_fifo_gpfifo_kick(struct gk104_fifo_chan *chan)
        ) < 0) {
                nvkm_error(subdev, "channel %d [%s] kick timeout\n",
                           chan->base.chid, client->name);
-               return -EBUSY;
+               ret = -ETIMEDOUT;
        }
-
-       return 0;
+       mutex_unlock(&subdev->mutex);
+       return ret;
 }
 
 static u32
index 212800ecdce99e4eb1a3a23ebdab9c207cd860da..7d1d3c6b4b728dec4711a75883df4d700a1a6290 100644 (file)
@@ -12,6 +12,7 @@ struct nvbios_source {
        bool rw;
        bool ignore_checksum;
        bool no_pcir;
+       bool require_checksum;
 };
 
 int nvbios_extend(struct nvkm_bios *, u32 length);
index b2557e87afdd6d0e95910b3b4b91e37ce9a3e269..7deb81b6dbac6bc5a440da281eca94b51b632f83 100644 (file)
@@ -86,9 +86,12 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd)
                    nvbios_checksum(&bios->data[image.base], image.size)) {
                        nvkm_debug(subdev, "%08x: checksum failed\n",
                                   image.base);
-                       if (mthd->func->rw)
+                       if (!mthd->func->require_checksum) {
+                               if (mthd->func->rw)
+                                       score += 1;
                                score += 1;
-                       score += 1;
+                       } else
+                               return 0;
                } else {
                        score += 3;
                }
index 8fecb5ff22a0efaaeaed9bc2b4939072fc6513bc..06572f8ce9148805ca37470c978af17f42e72827 100644 (file)
@@ -99,6 +99,7 @@ nvbios_acpi_fast = {
        .init = acpi_init,
        .read = acpi_read_fast,
        .rw = false,
+       .require_checksum = true,
 };
 
 const struct nvbios_source
index 85b1464c01942013f22055be345d751636bc68cb..587c52f08d3f5803b60ca23cd3f2972d611ffed9 100644 (file)
@@ -47,8 +47,10 @@ nvkm_ltc_tags_clear(struct nvkm_ltc *ltc, u32 first, u32 count)
 
        BUG_ON((first > limit) || (limit >= ltc->num_tags));
 
+       mutex_lock(&ltc->subdev.mutex);
        ltc->func->cbc_clear(ltc, first, limit);
        ltc->func->cbc_wait(ltc);
+       mutex_unlock(&ltc->subdev.mutex);
 }
 
 int
index afaf346bd50e7c7628674e29d0eea14c8403e3ec..b5b9cb911111b1c18bb697bc512d7081d126fc48 100644 (file)
@@ -90,6 +90,9 @@ static void radeon_show_cursor(struct drm_crtc *crtc)
        struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
        struct radeon_device *rdev = crtc->dev->dev_private;
 
+       if (radeon_crtc->cursor_out_of_bounds)
+               return;
+
        if (ASIC_IS_DCE4(rdev)) {
                WREG32(EVERGREEN_CUR_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset,
                       upper_32_bits(radeon_crtc->cursor_addr));
@@ -148,16 +151,17 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y)
                x += crtc->x;
                y += crtc->y;
        }
-       DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y);
 
-       if (x < 0) {
+       if (x < 0)
                xorigin = min(-x, radeon_crtc->max_cursor_width - 1);
-               x = 0;
-       }
-       if (y < 0) {
+       if (y < 0)
                yorigin = min(-y, radeon_crtc->max_cursor_height - 1);
-               y = 0;
+
+       if (!ASIC_IS_AVIVO(rdev)) {
+               x += crtc->x;
+               y += crtc->y;
        }
+       DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y);
 
        /* fixed on DCE6 and newer */
        if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE6(rdev)) {
@@ -180,27 +184,31 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y)
                if (i > 1) {
                        int cursor_end, frame_end;
 
-                       cursor_end = x - xorigin + w;
+                       cursor_end = x + w;
                        frame_end = crtc->x + crtc->mode.crtc_hdisplay;
                        if (cursor_end >= frame_end) {
                                w = w - (cursor_end - frame_end);
                                if (!(frame_end & 0x7f))
                                        w--;
-                       } else {
-                               if (!(cursor_end & 0x7f))
-                                       w--;
+                       } else if (cursor_end <= 0) {
+                               goto out_of_bounds;
+                       } else if (!(cursor_end & 0x7f)) {
+                               w--;
                        }
                        if (w <= 0) {
-                               w = 1;
-                               cursor_end = x - xorigin + w;
-                               if (!(cursor_end & 0x7f)) {
-                                       x--;
-                                       WARN_ON_ONCE(x < 0);
-                               }
+                               goto out_of_bounds;
                        }
                }
        }
 
+       if (x <= (crtc->x - w) || y <= (crtc->y - radeon_crtc->cursor_height) ||
+           x >= (crtc->x + crtc->mode.crtc_hdisplay) ||
+           y >= (crtc->y + crtc->mode.crtc_vdisplay))
+               goto out_of_bounds;
+
+       x += xorigin;
+       y += yorigin;
+
        if (ASIC_IS_DCE4(rdev)) {
                WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, (x << 16) | y);
                WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin);
@@ -212,6 +220,9 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y)
                WREG32(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset,
                       ((w - 1) << 16) | (radeon_crtc->cursor_height - 1));
        } else {
+               x -= crtc->x;
+               y -= crtc->y;
+
                if (crtc->mode.flags & DRM_MODE_FLAG_DBLSCAN)
                        y *= 2;
 
@@ -232,6 +243,19 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y)
        radeon_crtc->cursor_x = x;
        radeon_crtc->cursor_y = y;
 
+       if (radeon_crtc->cursor_out_of_bounds) {
+               radeon_crtc->cursor_out_of_bounds = false;
+               if (radeon_crtc->cursor_bo)
+                       radeon_show_cursor(crtc);
+       }
+
+       return 0;
+
+ out_of_bounds:
+       if (!radeon_crtc->cursor_out_of_bounds) {
+               radeon_hide_cursor(crtc);
+               radeon_crtc->cursor_out_of_bounds = true;
+       }
        return 0;
 }
 
@@ -297,22 +321,23 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
                return ret;
        }
 
-       radeon_crtc->cursor_width = width;
-       radeon_crtc->cursor_height = height;
-
        radeon_lock_cursor(crtc, true);
 
-       if (hot_x != radeon_crtc->cursor_hot_x ||
+       if (width != radeon_crtc->cursor_width ||
+           height != radeon_crtc->cursor_height ||
+           hot_x != radeon_crtc->cursor_hot_x ||
            hot_y != radeon_crtc->cursor_hot_y) {
                int x, y;
 
                x = radeon_crtc->cursor_x + radeon_crtc->cursor_hot_x - hot_x;
                y = radeon_crtc->cursor_y + radeon_crtc->cursor_hot_y - hot_y;
 
-               radeon_cursor_move_locked(crtc, x, y);
-
+               radeon_crtc->cursor_width = width;
+               radeon_crtc->cursor_height = height;
                radeon_crtc->cursor_hot_x = hot_x;
                radeon_crtc->cursor_hot_y = hot_y;
+
+               radeon_cursor_move_locked(crtc, x, y);
        }
 
        radeon_show_cursor(crtc);
index 7a0666ac4e235c3b6ff0795f592ec185f193a031..d8f8be608c19b5e19268e4592c3216b49222d2a6 100644 (file)
@@ -330,6 +330,7 @@ struct radeon_crtc {
        u16 lut_r[256], lut_g[256], lut_b[256];
        bool enabled;
        bool can_tile;
+       bool cursor_out_of_bounds;
        uint32_t crtc_offset;
        struct drm_gem_object *cursor_bo;
        uint64_t cursor_addr;
index 10191b935937c55ea125ace1a55d344bbe4bf146..eb2a2a49974f7ef18e00bb8e9c7078bcd3349e68 100644 (file)
@@ -3026,6 +3026,7 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
                    (rdev->pdev->revision == 0x80) ||
                    (rdev->pdev->revision == 0x81) ||
                    (rdev->pdev->revision == 0x83) ||
+                   (rdev->pdev->revision == 0x87) ||
                    (rdev->pdev->device == 0x6604) ||
                    (rdev->pdev->device == 0x6605)) {
                        max_sclk = 75000;
index 2281de122038e45a5c375f7d7669111ab2aee2de..8d84c563ba75351f053c223841c144e87afd80ec 100644 (file)
@@ -1745,7 +1745,7 @@ find_mad_agent(struct ib_mad_port_private *port_priv,
                        if (!class)
                                goto out;
                        if (convert_mgmt_class(mad_hdr->mgmt_class) >=
-                           IB_MGMT_MAX_METHODS)
+                           ARRAY_SIZE(class->method_table))
                                goto out;
                        method = class->method_table[convert_mgmt_class(
                                                        mad_hdr->mgmt_class)];
index 6aa648cb538139409e658d487102e3510f8489d5..2cd97977b988debeb92d11a2600dca9642d6fed9 100644 (file)
@@ -517,8 +517,11 @@ static void join_handler(int status, struct ib_sa_mcmember_rec *rec,
                process_join_error(group, status);
        else {
                int mgids_changed, is_mgid0;
-               ib_find_pkey(group->port->dev->device, group->port->port_num,
-                            be16_to_cpu(rec->pkey), &pkey_index);
+
+               if (ib_find_pkey(group->port->dev->device,
+                                group->port->port_num, be16_to_cpu(rec->pkey),
+                                &pkey_index))
+                       pkey_index = MCAST_INVALID_PKEY_INDEX;
 
                spin_lock_irq(&group->port->lock);
                if (group->state == MCAST_BUSY &&
index 87799de90a1debb6990f0bcb083a4f52c86a097c..8ec99bdea76b2de5a5a9f87cc4d26b78f4c80d2a 100644 (file)
@@ -563,8 +563,11 @@ void ipoib_mcast_join_task(struct work_struct *work)
        if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags))
                return;
 
-       if (ib_query_port(priv->ca, priv->port, &port_attr) ||
-           port_attr.state != IB_PORT_ACTIVE) {
+       if (ib_query_port(priv->ca, priv->port, &port_attr)) {
+               ipoib_dbg(priv, "ib_query_port() failed\n");
+               return;
+       }
+       if (port_attr.state != IB_PORT_ACTIVE) {
                ipoib_dbg(priv, "port state is not ACTIVE (state = %d) suspending join task\n",
                          port_attr.state);
                return;
index 2adfd86c869a5364312a2d8df904d2bd7df68b52..930424e55439d411ec8059f011d198766c8efa46 100644 (file)
@@ -592,7 +592,6 @@ static int drv260x_probe(struct i2c_client *client,
        }
 
        haptics->input_dev->name = "drv260x:haptics";
-       haptics->input_dev->dev.parent = client->dev.parent;
        haptics->input_dev->close = drv260x_close;
        input_set_drvdata(haptics->input_dev, haptics);
        input_set_capability(haptics->input_dev, EV_FF, FF_RUMBLE);
index 10ce885445f61dc162159b4fb7bb77c55d28e64b..7af976934441766f3d0978b8bc2b7764a3174fe1 100644 (file)
@@ -6980,6 +6980,15 @@ static int run(struct mddev *mddev)
                        stripe = (stripe | (stripe-1)) + 1;
                mddev->queue->limits.discard_alignment = stripe;
                mddev->queue->limits.discard_granularity = stripe;
+
+               /*
+                * We use 16-bit counter of active stripes in bi_phys_segments
+                * (minus one for over-loaded initialization)
+                */
+               blk_queue_max_hw_sectors(mddev->queue, 0xfffe * STRIPE_SECTORS);
+               blk_queue_max_discard_sectors(mddev->queue,
+                                             0xfffe * STRIPE_SECTORS);
+
                /*
                 * unaligned part of discard request will be ignored, so can't
                 * guarantee discard_zeroes_data
index 4ab6586c0467529ea145452f2e534f30edeb2a73..f53e59e9c0eab2d27c169f5fb4dec0e7d8ea33b2 100644 (file)
@@ -286,7 +286,10 @@ static inline u32 solo_reg_read(struct solo_dev *solo_dev, int reg)
 static inline void solo_reg_write(struct solo_dev *solo_dev, int reg,
                                  u32 data)
 {
+       u16 val;
+
        writel(data, solo_dev->reg_base + reg);
+       pci_read_config_word(solo_dev->pdev, PCI_STATUS, &val);
 }
 
 static inline void solo_irq_on(struct solo_dev *dev, u32 mask)
index 958af84884b57e8af7b68df6d3ab7319a963b583..2ff39fbc70d1d0af2d869865fe873de2b10f1119 100644 (file)
@@ -698,7 +698,7 @@ void mei_host_client_init(struct work_struct *work)
 
        pm_runtime_mark_last_busy(dev->dev);
        dev_dbg(dev->dev, "rpm: autosuspend\n");
-       pm_runtime_autosuspend(dev->dev);
+       pm_request_autosuspend(dev->dev);
 }
 
 /**
index 64a428984afee4da8c31b5ca01176eb1cf2b118f..7277dfd7338fb4bfa2b68bd400ee7b3e81618a2f 100644 (file)
@@ -2040,7 +2040,27 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
                        ctrl &= ~SDHCI_CTRL_EXEC_TUNING;
                        sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
 
+                       sdhci_do_reset(host, SDHCI_RESET_CMD);
+                       sdhci_do_reset(host, SDHCI_RESET_DATA);
+
                        err = -EIO;
+
+                       if (cmd.opcode != MMC_SEND_TUNING_BLOCK_HS200)
+                               goto out;
+
+                       sdhci_writel(host, host->ier, SDHCI_INT_ENABLE);
+                       sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE);
+
+                       spin_unlock_irqrestore(&host->lock, flags);
+
+                       memset(&cmd, 0, sizeof(cmd));
+                       cmd.opcode = MMC_STOP_TRANSMISSION;
+                       cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
+                       cmd.busy_timeout = 50;
+                       mmc_wait_for_cmd(mmc, &cmd, 0);
+
+                       spin_lock_irqsave(&host->lock, flags);
+
                        goto out;
                }
 
index a4beccf1fd46e26483dc796829d444a15f77723f..25aba988699051506c0ae6c72416004227203554 100644 (file)
@@ -772,6 +772,17 @@ struct mvpp2_rx_desc {
        u32 reserved8;
 };
 
+struct mvpp2_txq_pcpu_buf {
+       /* Transmitted SKB */
+       struct sk_buff *skb;
+
+       /* Physical address of transmitted buffer */
+       dma_addr_t phys;
+
+       /* Size transmitted */
+       size_t size;
+};
+
 /* Per-CPU Tx queue control */
 struct mvpp2_txq_pcpu {
        int cpu;
@@ -787,11 +798,8 @@ struct mvpp2_txq_pcpu {
        /* Number of Tx DMA descriptors reserved for each CPU */
        int reserved_num;
 
-       /* Array of transmitted skb */
-       struct sk_buff **tx_skb;
-
-       /* Array of transmitted buffers' physical addresses */
-       dma_addr_t *tx_buffs;
+       /* Infos about transmitted buffers */
+       struct mvpp2_txq_pcpu_buf *buffs;
 
        /* Index of last TX DMA descriptor that was inserted */
        int txq_put_index;
@@ -981,10 +989,11 @@ static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu,
                              struct sk_buff *skb,
                              struct mvpp2_tx_desc *tx_desc)
 {
-       txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb;
-       if (skb)
-               txq_pcpu->tx_buffs[txq_pcpu->txq_put_index] =
-                                                        tx_desc->buf_phys_addr;
+       struct mvpp2_txq_pcpu_buf *tx_buf =
+               txq_pcpu->buffs + txq_pcpu->txq_put_index;
+       tx_buf->skb = skb;
+       tx_buf->size = tx_desc->data_size;
+       tx_buf->phys = tx_desc->buf_phys_addr;
        txq_pcpu->txq_put_index++;
        if (txq_pcpu->txq_put_index == txq_pcpu->size)
                txq_pcpu->txq_put_index = 0;
@@ -4403,17 +4412,16 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
        int i;
 
        for (i = 0; i < num; i++) {
-               dma_addr_t buf_phys_addr =
-                                   txq_pcpu->tx_buffs[txq_pcpu->txq_get_index];
-               struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index];
+               struct mvpp2_txq_pcpu_buf *tx_buf =
+                       txq_pcpu->buffs + txq_pcpu->txq_get_index;
 
                mvpp2_txq_inc_get(txq_pcpu);
 
-               dma_unmap_single(port->dev->dev.parent, buf_phys_addr,
-                                skb_headlen(skb), DMA_TO_DEVICE);
-               if (!skb)
+               dma_unmap_single(port->dev->dev.parent, tx_buf->phys,
+                                tx_buf->size, DMA_TO_DEVICE);
+               if (!tx_buf->skb)
                        continue;
-               dev_kfree_skb_any(skb);
+               dev_kfree_skb_any(tx_buf->skb);
        }
 }
 
@@ -4664,15 +4672,10 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
        for_each_present_cpu(cpu) {
                txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
                txq_pcpu->size = txq->size;
-               txq_pcpu->tx_skb = kmalloc(txq_pcpu->size *
-                                          sizeof(*txq_pcpu->tx_skb),
-                                          GFP_KERNEL);
-               if (!txq_pcpu->tx_skb)
-                       goto error;
-
-               txq_pcpu->tx_buffs = kmalloc(txq_pcpu->size *
-                                            sizeof(dma_addr_t), GFP_KERNEL);
-               if (!txq_pcpu->tx_buffs)
+               txq_pcpu->buffs = kmalloc(txq_pcpu->size *
+                                         sizeof(struct mvpp2_txq_pcpu_buf),
+                                         GFP_KERNEL);
+               if (!txq_pcpu->buffs)
                        goto error;
 
                txq_pcpu->count = 0;
@@ -4686,8 +4689,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
 error:
        for_each_present_cpu(cpu) {
                txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
-               kfree(txq_pcpu->tx_skb);
-               kfree(txq_pcpu->tx_buffs);
+               kfree(txq_pcpu->buffs);
        }
 
        dma_free_coherent(port->dev->dev.parent,
@@ -4706,8 +4708,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port,
 
        for_each_present_cpu(cpu) {
                txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
-               kfree(txq_pcpu->tx_skb);
-               kfree(txq_pcpu->tx_buffs);
+               kfree(txq_pcpu->buffs);
        }
 
        if (txq->descs)
index 7cdaf40c3057d788dbfa01865c75178871655833..ea7b8c25955f2e78fb14dc46dd728568ec21c9a6 100644 (file)
@@ -27,7 +27,6 @@ static const struct pci_device_id ath_pci_id_table[] = {
        { PCI_VDEVICE(ATHEROS, 0x0023) }, /* PCI   */
        { PCI_VDEVICE(ATHEROS, 0x0024) }, /* PCI-E */
        { PCI_VDEVICE(ATHEROS, 0x0027) }, /* PCI   */
-       { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI   */
 
 #ifdef CONFIG_ATH9K_PCOEM
        /* Mini PCI AR9220 MB92 cards: Compex WLM200NX, Wistron DNMA-92 */
@@ -38,7 +37,7 @@ static const struct pci_device_id ath_pci_id_table[] = {
          .driver_data = ATH9K_PCI_LED_ACT_HI },
 #endif
 
-       { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
+       { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI   */
 
 #ifdef CONFIG_ATH9K_PCOEM
        { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
@@ -86,7 +85,11 @@ static const struct pci_device_id ath_pci_id_table[] = {
                         0x10CF, /* Fujitsu */
                         0x1536),
          .driver_data = ATH9K_PCI_D3_L1_WAR },
+#endif
 
+       { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
+
+#ifdef CONFIG_ATH9K_PCOEM
        /* AR9285 card for Asus */
        { PCI_DEVICE_SUB(PCI_VENDOR_ID_ATHEROS,
                         0x002B,
index 7a40d8dffa36a9b1eb2bc7000689058c9befe2be..aab752328c26940bf5a76b3e9235b08ff7b7d3e4 100644 (file)
@@ -1303,12 +1303,13 @@ EXPORT_SYMBOL_GPL(rtl_action_proc);
 
 static void setup_arp_tx(struct rtl_priv *rtlpriv, struct rtl_ps_ctl *ppsc)
 {
+       struct ieee80211_hw *hw = rtlpriv->hw;
+
        rtlpriv->ra.is_special_data = true;
        if (rtlpriv->cfg->ops->get_btc_status())
                rtlpriv->btcoexist.btc_ops->btc_special_packet_notify(
                                        rtlpriv, 1);
-       rtlpriv->enter_ps = false;
-       schedule_work(&rtlpriv->works.lps_change_work);
+       rtl_lps_leave(hw);
        ppsc->last_delaylps_stamp_jiffies = jiffies;
 }
 
@@ -1381,8 +1382,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
 
                if (is_tx) {
                        rtlpriv->ra.is_special_data = true;
-                       rtlpriv->enter_ps = false;
-                       schedule_work(&rtlpriv->works.lps_change_work);
+                       rtl_lps_leave(hw);
                        ppsc->last_delaylps_stamp_jiffies = jiffies;
                }
 
index c925a4dff5995b6934bfc5edcb28a45ec8bbe4c7..e36d8c45627577acfebf6554cc72a09394e59c21 100644 (file)
@@ -1153,10 +1153,8 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
                } else {
                        mstatus = RT_MEDIA_DISCONNECT;
 
-                       if (mac->link_state == MAC80211_LINKED) {
-                               rtlpriv->enter_ps = false;
-                               schedule_work(&rtlpriv->works.lps_change_work);
-                       }
+                       if (mac->link_state == MAC80211_LINKED)
+                               rtl_lps_leave(hw);
                        if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE)
                                rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
                        mac->link_state = MAC80211_NOLINK;
@@ -1432,8 +1430,7 @@ static void rtl_op_sw_scan_start(struct ieee80211_hw *hw,
        }
 
        if (mac->link_state == MAC80211_LINKED) {
-               rtlpriv->enter_ps = false;
-               schedule_work(&rtlpriv->works.lps_change_work);
+               rtl_lps_leave(hw);
                mac->link_state = MAC80211_LINKED_SCANNING;
        } else {
                rtl_ips_nic_on(hw);
index 5b4048041147667356aee1b08a8b64376c0d4dde..a52230377e2c84405ef11ed3c9fbf8e2d5b88159 100644 (file)
@@ -664,11 +664,9 @@ tx_status_ok:
        }
 
        if (((rtlpriv->link_info.num_rx_inperiod +
-               rtlpriv->link_info.num_tx_inperiod) > 8) ||
-               (rtlpriv->link_info.num_rx_inperiod > 2)) {
-               rtlpriv->enter_ps = false;
-               schedule_work(&rtlpriv->works.lps_change_work);
-       }
+             rtlpriv->link_info.num_tx_inperiod) > 8) ||
+             (rtlpriv->link_info.num_rx_inperiod > 2))
+               rtl_lps_leave(hw);
 }
 
 static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw,
@@ -919,10 +917,8 @@ new_trx_end:
                }
                if (((rtlpriv->link_info.num_rx_inperiod +
                      rtlpriv->link_info.num_tx_inperiod) > 8) ||
-                     (rtlpriv->link_info.num_rx_inperiod > 2)) {
-                       rtlpriv->enter_ps = false;
-                       schedule_work(&rtlpriv->works.lps_change_work);
-               }
+                     (rtlpriv->link_info.num_rx_inperiod > 2))
+                       rtl_lps_leave(hw);
                skb = new_skb;
 no_new:
                if (rtlpriv->use_new_trx_flow) {
index b69321d45f043a8727f5e02341b1bc9cd91f4617..626ff300352b7f4aba6dfda73dd79a3b47be2c64 100644 (file)
@@ -414,8 +414,8 @@ void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode)
        }
 }
 
-/*Enter the leisure power save mode.*/
-void rtl_lps_enter(struct ieee80211_hw *hw)
+/* Interrupt safe routine to enter the leisure power save mode.*/
+static void rtl_lps_enter_core(struct ieee80211_hw *hw)
 {
        struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
        struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
@@ -455,10 +455,9 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
 
        spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag);
 }
-EXPORT_SYMBOL(rtl_lps_enter);
 
-/*Leave the leisure power save mode.*/
-void rtl_lps_leave(struct ieee80211_hw *hw)
+/* Interrupt safe routine to leave the leisure power save mode.*/
+static void rtl_lps_leave_core(struct ieee80211_hw *hw)
 {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
@@ -488,7 +487,6 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
        }
        spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag);
 }
-EXPORT_SYMBOL(rtl_lps_leave);
 
 /* For sw LPS*/
 void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len)
@@ -681,12 +679,34 @@ void rtl_lps_change_work_callback(struct work_struct *work)
        struct rtl_priv *rtlpriv = rtl_priv(hw);
 
        if (rtlpriv->enter_ps)
-               rtl_lps_enter(hw);
+               rtl_lps_enter_core(hw);
        else
-               rtl_lps_leave(hw);
+               rtl_lps_leave_core(hw);
 }
 EXPORT_SYMBOL_GPL(rtl_lps_change_work_callback);
 
+void rtl_lps_enter(struct ieee80211_hw *hw)
+{
+       struct rtl_priv *rtlpriv = rtl_priv(hw);
+
+       if (!in_interrupt())
+               return rtl_lps_enter_core(hw);
+       rtlpriv->enter_ps = true;
+       schedule_work(&rtlpriv->works.lps_change_work);
+}
+EXPORT_SYMBOL_GPL(rtl_lps_enter);
+
+void rtl_lps_leave(struct ieee80211_hw *hw)
+{
+       struct rtl_priv *rtlpriv = rtl_priv(hw);
+
+       if (!in_interrupt())
+               return rtl_lps_leave_core(hw);
+       rtlpriv->enter_ps = false;
+       schedule_work(&rtlpriv->works.lps_change_work);
+}
+EXPORT_SYMBOL_GPL(rtl_lps_leave);
+
 void rtl_swlps_wq_callback(void *data)
 {
        struct rtl_works *rtlworks = container_of_dwork_rtl(data,
index 42d8617352ae8dff39ce7b56d75b3ac9631fa6f4..e311a9bf2c90d602e3ced4725b22562c733660cf 100644 (file)
@@ -2043,6 +2043,10 @@ bool pci_dev_run_wake(struct pci_dev *dev)
        if (!dev->pme_support)
                return false;
 
+       /* PME-capable in principle, but not from the intended sleep state */
+       if (!pci_pme_capable(dev, pci_target_state(dev)))
+               return false;
+
        while (bus->parent) {
                struct pci_dev *bridge = bus->self;
 
index 131fee2b093eadde86ba6c0b0fc53be458150e82..a3661cc44f86fdc205d16ab110187862b7f2f3fb 100644 (file)
@@ -126,6 +126,15 @@ static const struct dmi_system_id asus_quirks[] = {
                },
                .driver_data = &quirk_asus_wapf4,
        },
+       {
+               .callback = dmi_matched,
+               .ident = "ASUSTeK COMPUTER INC. X45U",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "X45U"),
+               },
+               .driver_data = &quirk_asus_wapf4,
+       },
        {
                .callback = dmi_matched,
                .ident = "ASUSTeK COMPUTER INC. X456UA",
index 7d2ae3e9e942f26f302f526450487213da2cc44d..342f5da799758e0d054ef2aaa64c9ff1c566365e 100644 (file)
@@ -47,7 +47,8 @@ static struct regulator_desc vmmc_regulator = {
        .volt_table = stw481x_vmmc_voltages,
        .enable_time = 200, /* FIXME: look this up */
        .enable_reg = STW_CONF1,
-       .enable_mask = STW_CONF1_PDN_VMMC,
+       .enable_mask = STW_CONF1_PDN_VMMC | STW_CONF1_MMC_LS_STATUS,
+       .enable_val = STW_CONF1_PDN_VMMC,
        .vsel_reg = STW_CONF1,
        .vsel_mask = STW_CONF1_VMMC_MASK,
 };
index 799c1524c779f282387b3ed79c5363f95b1fbd98..4b8de3e70cf2d2d67718b25b522414424d9e6f0e 100644 (file)
@@ -872,7 +872,7 @@ static int __init vmlogrdr_init(void)
                goto cleanup;
 
        for (i=0; i < MAXMINOR; ++i ) {
-               sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL);
+               sys_ser[i].buffer = (char *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
                if (!sys_ser[i].buffer) {
                        rc = -ENOMEM;
                        break;
index 581001989937ce1e0aaab11c26136d5e11b4fa4d..d5bf36ec8a751326062e47abe80ddd1f61a5f43b 100644 (file)
@@ -289,11 +289,12 @@ void zfcp_dbf_rec_trig(char *tag, struct zfcp_adapter *adapter,
 
 
 /**
- * zfcp_dbf_rec_run - trace event related to running recovery
+ * zfcp_dbf_rec_run_lvl - trace event related to running recovery
+ * @level: trace level to be used for event
  * @tag: identifier for event
  * @erp: erp_action running
  */
-void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)
+void zfcp_dbf_rec_run_lvl(int level, char *tag, struct zfcp_erp_action *erp)
 {
        struct zfcp_dbf *dbf = erp->adapter->dbf;
        struct zfcp_dbf_rec *rec = &dbf->rec_buf;
@@ -319,10 +320,20 @@ void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)
        else
                rec->u.run.rec_count = atomic_read(&erp->adapter->erp_counter);
 
-       debug_event(dbf->rec, 1, rec, sizeof(*rec));
+       debug_event(dbf->rec, level, rec, sizeof(*rec));
        spin_unlock_irqrestore(&dbf->rec_lock, flags);
 }
 
+/**
+ * zfcp_dbf_rec_run - trace event related to running recovery
+ * @tag: identifier for event
+ * @erp: erp_action running
+ */
+void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp)
+{
+       zfcp_dbf_rec_run_lvl(1, tag, erp);
+}
+
 /**
  * zfcp_dbf_rec_run_wka - trace wka port event with info like running recovery
  * @tag: identifier for event
index 36d07584271d569d27ec2eeb3706235d6459e026..db186d44cfafb6036a7e452e68e2c8f078cff6d1 100644 (file)
@@ -2,7 +2,7 @@
  * zfcp device driver
  * debug feature declarations
  *
- * Copyright IBM Corp. 2008, 2015
+ * Copyright IBM Corp. 2008, 2016
  */
 
 #ifndef ZFCP_DBF_H
@@ -283,6 +283,30 @@ struct zfcp_dbf {
        struct zfcp_dbf_scsi            scsi_buf;
 };
 
+/**
+ * zfcp_dbf_hba_fsf_resp_suppress - true if we should not trace by default
+ * @req: request that has been completed
+ *
+ * Returns true if FCP response with only benign residual under count.
+ */
+static inline
+bool zfcp_dbf_hba_fsf_resp_suppress(struct zfcp_fsf_req *req)
+{
+       struct fsf_qtcb *qtcb = req->qtcb;
+       u32 fsf_stat = qtcb->header.fsf_status;
+       struct fcp_resp *fcp_rsp;
+       u8 rsp_flags, fr_status;
+
+       if (qtcb->prefix.qtcb_type != FSF_IO_COMMAND)
+               return false; /* not an FCP response */
+       fcp_rsp = (struct fcp_resp *)&qtcb->bottom.io.fcp_rsp;
+       rsp_flags = fcp_rsp->fr_flags;
+       fr_status = fcp_rsp->fr_status;
+       return (fsf_stat == FSF_FCP_RSP_AVAILABLE) &&
+               (rsp_flags == FCP_RESID_UNDER) &&
+               (fr_status == SAM_STAT_GOOD);
+}
+
 static inline
 void zfcp_dbf_hba_fsf_resp(char *tag, int level, struct zfcp_fsf_req *req)
 {
@@ -304,7 +328,9 @@ void zfcp_dbf_hba_fsf_response(struct zfcp_fsf_req *req)
                zfcp_dbf_hba_fsf_resp("fs_perr", 1, req);
 
        } else if (qtcb->header.fsf_status != FSF_GOOD) {
-               zfcp_dbf_hba_fsf_resp("fs_ferr", 1, req);
+               zfcp_dbf_hba_fsf_resp("fs_ferr",
+                                     zfcp_dbf_hba_fsf_resp_suppress(req)
+                                     ? 5 : 1, req);
 
        } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
                   (req->fsf_command == FSF_QTCB_OPEN_LUN)) {
@@ -388,4 +414,15 @@ void zfcp_dbf_scsi_devreset(char *tag, struct scsi_cmnd *scmnd, u8 flag)
        _zfcp_dbf_scsi(tmp_tag, 1, scmnd, NULL);
 }
 
+/**
+ * zfcp_dbf_scsi_nullcmnd() - trace NULLify of SCSI command in dev/tgt-reset.
+ * @scmnd: SCSI command that was NULLified.
+ * @fsf_req: request that owned @scmnd.
+ */
+static inline void zfcp_dbf_scsi_nullcmnd(struct scsi_cmnd *scmnd,
+                                         struct zfcp_fsf_req *fsf_req)
+{
+       _zfcp_dbf_scsi("scfc__1", 3, scmnd, fsf_req);
+}
+
 #endif /* ZFCP_DBF_H */
index a59d678125bd0e0ad0bd1ca74b0d42985abb25d8..7ccfce55903423f5e998fe3d93f6942a5879376f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Error Recovery Procedures (ERP).
  *
- * Copyright IBM Corp. 2002, 2015
+ * Copyright IBM Corp. 2002, 2016
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -1204,6 +1204,62 @@ static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action)
        }
 }
 
+/**
+ * zfcp_erp_try_rport_unblock - unblock rport if no more/new recovery
+ * @port: zfcp_port whose fc_rport we should try to unblock
+ */
+static void zfcp_erp_try_rport_unblock(struct zfcp_port *port)
+{
+       unsigned long flags;
+       struct zfcp_adapter *adapter = port->adapter;
+       int port_status;
+       struct Scsi_Host *shost = adapter->scsi_host;
+       struct scsi_device *sdev;
+
+       write_lock_irqsave(&adapter->erp_lock, flags);
+       port_status = atomic_read(&port->status);
+       if ((port_status & ZFCP_STATUS_COMMON_UNBLOCKED)    == 0 ||
+           (port_status & (ZFCP_STATUS_COMMON_ERP_INUSE |
+                           ZFCP_STATUS_COMMON_ERP_FAILED)) != 0) {
+               /* new ERP of severity >= port triggered elsewhere meanwhile or
+                * local link down (adapter erp_failed but not clear unblock)
+                */
+               zfcp_dbf_rec_run_lvl(4, "ertru_p", &port->erp_action);
+               write_unlock_irqrestore(&adapter->erp_lock, flags);
+               return;
+       }
+       spin_lock(shost->host_lock);
+       __shost_for_each_device(sdev, shost) {
+               struct zfcp_scsi_dev *zsdev = sdev_to_zfcp(sdev);
+               int lun_status;
+
+               if (zsdev->port != port)
+                       continue;
+               /* LUN under port of interest */
+               lun_status = atomic_read(&zsdev->status);
+               if ((lun_status & ZFCP_STATUS_COMMON_ERP_FAILED) != 0)
+                       continue; /* unblock rport despite failed LUNs */
+               /* LUN recovery not given up yet [maybe follow-up pending] */
+               if ((lun_status & ZFCP_STATUS_COMMON_UNBLOCKED) == 0 ||
+                   (lun_status & ZFCP_STATUS_COMMON_ERP_INUSE) != 0) {
+                       /* LUN blocked:
+                        * not yet unblocked [LUN recovery pending]
+                        * or meanwhile blocked [new LUN recovery triggered]
+                        */
+                       zfcp_dbf_rec_run_lvl(4, "ertru_l", &zsdev->erp_action);
+                       spin_unlock(shost->host_lock);
+                       write_unlock_irqrestore(&adapter->erp_lock, flags);
+                       return;
+               }
+       }
+       /* now port has no child or all children have completed recovery,
+        * and no ERP of severity >= port was meanwhile triggered elsewhere
+        */
+       zfcp_scsi_schedule_rport_register(port);
+       spin_unlock(shost->host_lock);
+       write_unlock_irqrestore(&adapter->erp_lock, flags);
+}
+
 static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
 {
        struct zfcp_adapter *adapter = act->adapter;
@@ -1214,6 +1270,7 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
        case ZFCP_ERP_ACTION_REOPEN_LUN:
                if (!(act->status & ZFCP_STATUS_ERP_NO_REF))
                        scsi_device_put(sdev);
+               zfcp_erp_try_rport_unblock(port);
                break;
 
        case ZFCP_ERP_ACTION_REOPEN_PORT:
@@ -1224,7 +1281,7 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
                 */
                if (act->step != ZFCP_ERP_STEP_UNINITIALIZED)
                        if (result == ZFCP_ERP_SUCCEEDED)
-                               zfcp_scsi_schedule_rport_register(port);
+                               zfcp_erp_try_rport_unblock(port);
                /* fall through */
        case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
                put_device(&port->dev);
index c8fed9fa1cca3680015913162ce3ddfee50c85b1..21c8c689b02bb1f507398e3477e507027eec4732 100644 (file)
@@ -3,7 +3,7 @@
  *
  * External function declarations.
  *
- * Copyright IBM Corp. 2002, 2015
+ * Copyright IBM Corp. 2002, 2016
  */
 
 #ifndef ZFCP_EXT_H
@@ -35,6 +35,8 @@ extern void zfcp_dbf_adapter_unregister(struct zfcp_adapter *);
 extern void zfcp_dbf_rec_trig(char *, struct zfcp_adapter *,
                              struct zfcp_port *, struct scsi_device *, u8, u8);
 extern void zfcp_dbf_rec_run(char *, struct zfcp_erp_action *);
+extern void zfcp_dbf_rec_run_lvl(int level, char *tag,
+                                struct zfcp_erp_action *erp);
 extern void zfcp_dbf_rec_run_wka(char *, struct zfcp_fc_wka_port *, u64);
 extern void zfcp_dbf_hba_fsf_uss(char *, struct zfcp_fsf_req *);
 extern void zfcp_dbf_hba_fsf_res(char *, int, struct zfcp_fsf_req *);
index be1c04b334c51f678d643e4c488173f8fd6be0ee..ea3c76ac0de14dc8ea9ad147d1f5b9ab80cc1172 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Interface to the FSF support functions.
  *
- * Copyright IBM Corp. 2002, 2015
+ * Copyright IBM Corp. 2002, 2016
  */
 
 #ifndef FSF_H
@@ -78,6 +78,7 @@
 #define FSF_APP_TAG_CHECK_FAILURE              0x00000082
 #define FSF_REF_TAG_CHECK_FAILURE              0x00000083
 #define FSF_ADAPTER_STATUS_AVAILABLE           0x000000AD
+#define FSF_FCP_RSP_AVAILABLE                  0x000000AF
 #define FSF_UNKNOWN_COMMAND                    0x000000E2
 #define FSF_UNKNOWN_OP_SUBTYPE                  0x000000E3
 #define FSF_INVALID_COMMAND_OPTION              0x000000E5
index 7c2c6194dfca58e1eb2fe6466abf64fd928deb96..703fce59befef0be884449e00addad4a49981d61 100644 (file)
@@ -4,7 +4,7 @@
  * Data structure and helper functions for tracking pending FSF
  * requests.
  *
- * Copyright IBM Corp. 2009
+ * Copyright IBM Corp. 2009, 2016
  */
 
 #ifndef ZFCP_REQLIST_H
@@ -180,4 +180,32 @@ static inline void zfcp_reqlist_move(struct zfcp_reqlist *rl,
        spin_unlock_irqrestore(&rl->lock, flags);
 }
 
+/**
+ * zfcp_reqlist_apply_for_all() - apply a function to every request.
+ * @rl: the requestlist that contains the target requests.
+ * @f: the function to apply to each request; the first parameter of the
+ *     function will be the target-request; the second parameter is the same
+ *     pointer as given with the argument @data.
+ * @data: freely chosen argument; passed through to @f as second parameter.
+ *
+ * Uses :c:macro:`list_for_each_entry` to iterate over the lists in the hash-
+ * table (not a 'safe' variant, so don't modify the list).
+ *
+ * Holds @rl->lock over the entire request-iteration.
+ */
+static inline void
+zfcp_reqlist_apply_for_all(struct zfcp_reqlist *rl,
+                          void (*f)(struct zfcp_fsf_req *, void *), void *data)
+{
+       struct zfcp_fsf_req *req;
+       unsigned long flags;
+       unsigned int i;
+
+       spin_lock_irqsave(&rl->lock, flags);
+       for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
+               list_for_each_entry(req, &rl->buckets[i], list)
+                       f(req, data);
+       spin_unlock_irqrestore(&rl->lock, flags);
+}
+
 #endif /* ZFCP_REQLIST_H */
index 9069f98a18172e754c943010654de65e91c2fb7c..07ffdbb5107f732082e88c94b0362b845e7e17d6 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Interface to Linux SCSI midlayer.
  *
- * Copyright IBM Corp. 2002, 2015
+ * Copyright IBM Corp. 2002, 2016
  */
 
 #define KMSG_COMPONENT "zfcp"
@@ -88,9 +88,7 @@ int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)
        }
 
        if (unlikely(!(status & ZFCP_STATUS_COMMON_UNBLOCKED))) {
-               /* This could be either
-                * open LUN pending: this is temporary, will result in
-                *      open LUN or ERP_FAILED, so retry command
+               /* This could be
                 * call to rport_delete pending: mimic retry from
                 *      fc_remote_port_chkready until rport is BLOCKED
                 */
@@ -209,6 +207,57 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
        return retval;
 }
 
+struct zfcp_scsi_req_filter {
+       u8 tmf_scope;
+       u32 lun_handle;
+       u32 port_handle;
+};
+
+static void zfcp_scsi_forget_cmnd(struct zfcp_fsf_req *old_req, void *data)
+{
+       struct zfcp_scsi_req_filter *filter =
+               (struct zfcp_scsi_req_filter *)data;
+
+       /* already aborted - prevent side-effects - or not a SCSI command */
+       if (old_req->data == NULL || old_req->fsf_command != FSF_QTCB_FCP_CMND)
+               return;
+
+       /* (tmf_scope == FCP_TMF_TGT_RESET || tmf_scope == FCP_TMF_LUN_RESET) */
+       if (old_req->qtcb->header.port_handle != filter->port_handle)
+               return;
+
+       if (filter->tmf_scope == FCP_TMF_LUN_RESET &&
+           old_req->qtcb->header.lun_handle != filter->lun_handle)
+               return;
+
+       zfcp_dbf_scsi_nullcmnd((struct scsi_cmnd *)old_req->data, old_req);
+       old_req->data = NULL;
+}
+
+static void zfcp_scsi_forget_cmnds(struct zfcp_scsi_dev *zsdev, u8 tm_flags)
+{
+       struct zfcp_adapter *adapter = zsdev->port->adapter;
+       struct zfcp_scsi_req_filter filter = {
+               .tmf_scope = FCP_TMF_TGT_RESET,
+               .port_handle = zsdev->port->handle,
+       };
+       unsigned long flags;
+
+       if (tm_flags == FCP_TMF_LUN_RESET) {
+               filter.tmf_scope = FCP_TMF_LUN_RESET;
+               filter.lun_handle = zsdev->lun_handle;
+       }
+
+       /*
+        * abort_lock secures against other processings - in the abort-function
+        * and normal cmnd-handler - of (struct zfcp_fsf_req *)->data
+        */
+       write_lock_irqsave(&adapter->abort_lock, flags);
+       zfcp_reqlist_apply_for_all(adapter->req_list, zfcp_scsi_forget_cmnd,
+                                  &filter);
+       write_unlock_irqrestore(&adapter->abort_lock, flags);
+}
+
 static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
 {
        struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
@@ -241,8 +290,10 @@ static int zfcp_task_mgmt_function(struct scsi_cmnd *scpnt, u8 tm_flags)
        if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCFAILED) {
                zfcp_dbf_scsi_devreset("fail", scpnt, tm_flags);
                retval = FAILED;
-       } else
+       } else {
                zfcp_dbf_scsi_devreset("okay", scpnt, tm_flags);
+               zfcp_scsi_forget_cmnds(zfcp_sdev, tm_flags);
+       }
 
        zfcp_fsf_req_free(fsf_req);
        return retval;
index 021b994fdae8d08e95df2dac143125131aca32ff..96007633ad39b2e266fbc66c34e9eaf40a72ed1e 100644 (file)
@@ -1856,6 +1856,8 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
                io_request->DevHandle = pd_sync->seq[pd_index].devHandle;
                pRAID_Context->regLockFlags |=
                        (MR_RL_FLAGS_SEQ_NUM_ENABLE|MR_RL_FLAGS_GRANT_DESTINATION_CUDA);
+               pRAID_Context->Type = MPI2_TYPE_CUDA;
+               pRAID_Context->nseg = 0x1;
        } else if (fusion->fast_path_io) {
                pRAID_Context->VirtualDiskTgtId = cpu_to_le16(device_id);
                pRAID_Context->configSeqNum = 0;
@@ -1891,12 +1893,10 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
                pRAID_Context->timeoutValue =
                        cpu_to_le16((os_timeout_value > timeout_limit) ?
                        timeout_limit : os_timeout_value);
-               if (fusion->adapter_type == INVADER_SERIES) {
-                       pRAID_Context->Type = MPI2_TYPE_CUDA;
-                       pRAID_Context->nseg = 0x1;
+               if (fusion->adapter_type == INVADER_SERIES)
                        io_request->IoFlags |=
                                cpu_to_le16(MPI25_SAS_DEVICE0_FLAGS_ENABLED_FAST_PATH);
-               }
+
                cmd->request_desc->SCSIIO.RequestFlags =
                        (MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY <<
                                MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
@@ -2648,6 +2648,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
                dev_err(&instance->pdev->dev, "pending commands remain after waiting, "
                       "will reset adapter scsi%d.\n",
                       instance->host->host_no);
+               *convert = 1;
                retval = 1;
        }
 out:
index 7232d43e2207d36c0b8368c7c880352e82abe60e..4477e999ec707c7c18b077c3061fb34b6cf85309 100644 (file)
@@ -1031,10 +1031,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
        struct request_queue *rq = sdev->request_queue;
        struct scsi_target *starget = sdev->sdev_target;
 
-       error = scsi_device_set_state(sdev, SDEV_RUNNING);
-       if (error)
-               return error;
-
        error = scsi_target_add(starget);
        if (error)
                return error;
index ae7d9bdf409c816d014ac2d668a1e449fce0c8e9..a1c29b0afb22e10cb4ae741a2080ad8cbcae1cbd 100644 (file)
@@ -592,6 +592,9 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
        sg_io_hdr_t *hp;
        unsigned char cmnd[SG_MAX_CDB_SIZE];
 
+       if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
+               return -EINVAL;
+
        if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
                return -ENXIO;
        SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp,
index 0f28c08fcb3c76f4a2deaf3cd084a39f800db142..77b551da57288c11d21d6ff40b65b1d8b01ed887 100644 (file)
@@ -909,6 +909,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
                        if (err) {
                                ssb_warn("WARNING: Using fallback SPROM failed (err %d)\n",
                                         err);
+                               goto out_free;
                        } else {
                                ssb_dbg("Using SPROM revision %d provided by platform\n",
                                        sprom->revision);
index 35ab4a9ef95d62f02c4058eadaf27d87ebe85ee7..c975f6e8be49eb097b51b79afdbaeff1b69c5214 100644 (file)
@@ -1929,7 +1929,7 @@ static int ni_ai_insn_read(struct comedi_device *dev,
                           unsigned int *data)
 {
        struct ni_private *devpriv = dev->private;
-       unsigned int mask = (s->maxdata + 1) >> 1;
+       unsigned int mask = s->maxdata;
        int i, n;
        unsigned signbits;
        unsigned int d;
@@ -1972,7 +1972,7 @@ static int ni_ai_insn_read(struct comedi_device *dev,
                                return -ETIME;
                        }
                        d += signbits;
-                       data[n] = d;
+                       data[n] = d & 0xffff;
                }
        } else if (devpriv->is_6143) {
                for (n = 0; n < insn->n; n++) {
@@ -2017,8 +2017,8 @@ static int ni_ai_insn_read(struct comedi_device *dev,
                                data[n] = dl;
                        } else {
                                d = ni_readw(dev, NI_E_AI_FIFO_DATA_REG);
-                               d += signbits;  /* subtle: needs to be short addition */
-                               data[n] = d;
+                               d += signbits;
+                               data[n] = d & 0xffff;
                        }
                }
        }
index 5e6d6cb348fc1c902ea74079357430d5dfb0d44a..a7d30e894cab2659aac52c7c59dea950f32c6ef9 100644 (file)
@@ -645,8 +645,6 @@ static int tcmu_check_expired_cmd(int id, void *p, void *data)
        target_complete_cmd(cmd->se_cmd, SAM_STAT_CHECK_CONDITION);
        cmd->se_cmd = NULL;
 
-       kmem_cache_free(tcmu_cmd_cache, cmd);
-
        return 0;
 }
 
index 06fd2ed9ef9d13bf0ab09f727020f873152b8da9..705b0cafedbb442d6f96e09b606171c4e1e77b9d 100644 (file)
@@ -98,7 +98,7 @@ temp_crit_show(struct device *dev, struct device_attribute *attr, char *buf)
        int temperature;
        int ret;
 
-       ret = tz->ops->get_trip_temp(tz, 0, &temperature);
+       ret = tz->ops->get_crit_temp(tz, &temperature);
        if (ret)
                return ret;
 
index edb5305b9d4da72e388452f66db9e65e40d15f18..7d5ee8a13ac657ea4ee2b959bc15e680349022ea 100644 (file)
@@ -1230,7 +1230,7 @@ static int sc16is7xx_probe(struct device *dev,
 
        /* Setup interrupt */
        ret = devm_request_irq(dev, irq, sc16is7xx_irq,
-                              IRQF_ONESHOT | flags, dev_name(dev), s);
+                              flags, dev_name(dev), s);
        if (!ret)
                return 0;
 
index 41987a55a5383e0560b03a102251e2f0f40ecd92..988c564b61a88bd5019d2dba18b1ee608f8acbb4 100644 (file)
@@ -982,7 +982,7 @@ static void kbd_led_trigger_activate(struct led_classdev *cdev)
        KBD_LED_TRIGGER((_led_bit) + 8, _name)
 
 static struct kbd_led_trigger kbd_led_triggers[] = {
-       KBD_LED_TRIGGER(VC_SCROLLOCK, "kbd-scrollock"),
+       KBD_LED_TRIGGER(VC_SCROLLOCK, "kbd-scrolllock"),
        KBD_LED_TRIGGER(VC_NUMLOCK,   "kbd-numlock"),
        KBD_LED_TRIGGER(VC_CAPSLOCK,  "kbd-capslock"),
        KBD_LED_TRIGGER(VC_KANALOCK,  "kbd-kanalock"),
index f10dbac851a11d0d283c0ea25eaeb76a9b297882..198aea66fe71c7d8cb24416be9332c41507173e7 100644 (file)
@@ -1806,6 +1806,7 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
        spin_lock(&blockdev_superblock->s_inode_list_lock);
        list_for_each_entry(inode, &blockdev_superblock->s_inodes, i_sb_list) {
                struct address_space *mapping = inode->i_mapping;
+               struct block_device *bdev;
 
                spin_lock(&inode->i_lock);
                if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW) ||
@@ -1826,8 +1827,12 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)
                 */
                iput(old_inode);
                old_inode = inode;
+               bdev = I_BDEV(inode);
 
-               func(I_BDEV(inode), arg);
+               mutex_lock(&bdev->bd_mutex);
+               if (bdev->bd_openers)
+                       func(bdev, arg);
+               mutex_unlock(&bdev->bd_mutex);
 
                spin_lock(&blockdev_superblock->s_inode_list_lock);
        }
index 93e236429c5d785a1711d643d0b4676dfe4396cf..dc875cd0e11d52386c893ee83c1c71ff40f855ef 100644 (file)
@@ -407,7 +407,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
         */
        if (!PageUptodate(page)) {
                unsigned pglen = nfs_page_length(page);
-               unsigned end = offset + len;
+               unsigned end = offset + copied;
 
                if (pglen == 0) {
                        zero_user_segments(page, 0, offset,
index 2c7bdb81d30c80725b9e7d704f908609a38da6b8..b5f3693fe5b614172fb089674c9999980772621d 100644 (file)
@@ -4257,6 +4257,17 @@ void cfg80211_rx_assoc_resp(struct net_device *dev,
  */
 void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
 
+/**
+ * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
+ * @dev: network device
+ * @bss: The BSS entry with which association was abandoned.
+ *
+ * Call this whenever - for reasons reported through other API, like deauth RX,
+ * an association attempt was abandoned.
+ * This function may sleep. The caller must hold the corresponding wdev's mutex.
+ */
+void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
+
 /**
  * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
  * @dev: network device
index 11528591d0d714f3ea1004566cb799952a9ca5bd..a78ff97eb249fa068b9e1f00387e86861add22eb 100644 (file)
@@ -197,10 +197,12 @@ static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr,
 
        dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if);
        if (dev) {
-               ip4 = (struct in_device *)dev->ip_ptr;
-               if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address)
+               ip4 = in_dev_get(dev);
+               if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) {
                        ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address,
                                               (struct in6_addr *)gid);
+                       in_dev_put(ip4);
+               }
                dev_put(dev);
        }
 }
index ede4bf13d3e93649be0a474000607c6a3b898965..5fa544f3f560416c3962b88c7cca392f94dac20e 100644 (file)
@@ -298,10 +298,10 @@ u32 (*arch_gettimeoffset)(void) = default_arch_gettimeoffset;
 static inline u32 arch_gettimeoffset(void) { return 0; }
 #endif
 
-static inline s64 timekeeping_delta_to_ns(struct tk_read_base *tkr,
+static inline u64 timekeeping_delta_to_ns(struct tk_read_base *tkr,
                                          cycle_t delta)
 {
-       s64 nsec;
+       u64 nsec;
 
        nsec = delta * tkr->mult + tkr->xtime_nsec;
        nsec >>= tkr->shift;
index 4641bdb40f8ff50aeee0f9c2d06eb462b3c19e40..96c75b0e983130f68b886b5400994573f5e86dc6 100644 (file)
@@ -785,6 +785,10 @@ print_graph_entry_leaf(struct trace_iterator *iter,
 
                cpu_data = per_cpu_ptr(data->cpu_data, cpu);
 
+               /* If a graph tracer ignored set_graph_notrace */
+               if (call->depth < -1)
+                       call->depth += FTRACE_NOTRACE_DEPTH;
+
                /*
                 * Comments display at + 1 to depth. Since
                 * this is a leaf function, keep the comments
@@ -793,7 +797,8 @@ print_graph_entry_leaf(struct trace_iterator *iter,
                cpu_data->depth = call->depth - 1;
 
                /* No need to keep this function around for this depth */
-               if (call->depth < FTRACE_RETFUNC_DEPTH)
+               if (call->depth < FTRACE_RETFUNC_DEPTH &&
+                   !WARN_ON_ONCE(call->depth < 0))
                        cpu_data->enter_funcs[call->depth] = 0;
        }
 
@@ -823,11 +828,16 @@ print_graph_entry_nested(struct trace_iterator *iter,
                struct fgraph_cpu_data *cpu_data;
                int cpu = iter->cpu;
 
+               /* If a graph tracer ignored set_graph_notrace */
+               if (call->depth < -1)
+                       call->depth += FTRACE_NOTRACE_DEPTH;
+
                cpu_data = per_cpu_ptr(data->cpu_data, cpu);
                cpu_data->depth = call->depth;
 
                /* Save this function pointer to see if the exit matches */
-               if (call->depth < FTRACE_RETFUNC_DEPTH)
+               if (call->depth < FTRACE_RETFUNC_DEPTH &&
+                   !WARN_ON_ONCE(call->depth < 0))
                        cpu_data->enter_funcs[call->depth] = call->func;
        }
 
@@ -1057,7 +1067,8 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
                 */
                cpu_data->depth = trace->depth - 1;
 
-               if (trace->depth < FTRACE_RETFUNC_DEPTH) {
+               if (trace->depth < FTRACE_RETFUNC_DEPTH &&
+                   !WARN_ON_ONCE(trace->depth < 0)) {
                        if (cpu_data->enter_funcs[trace->depth] != trace->func)
                                func_match = 0;
                        cpu_data->enter_funcs[trace->depth] = 0;
index 63ae5dd24fc597277ac384cb06b27ea16c6db25b..b8d927c564942fb7984f39b57e9ce27925a49042 100644 (file)
@@ -2042,6 +2042,19 @@ static int process_connect(struct ceph_connection *con)
 
        dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
 
+       if (con->auth_reply_buf) {
+               /*
+                * Any connection that defines ->get_authorizer()
+                * should also define ->verify_authorizer_reply().
+                * See get_connect_authorizer().
+                */
+               ret = con->ops->verify_authorizer_reply(con, 0);
+               if (ret < 0) {
+                       con->error_msg = "bad authorize reply";
+                       return ret;
+               }
+       }
+
        switch (con->in_reply.tag) {
        case CEPH_MSGR_TAG_FEATURES:
                pr_err("%s%lld %s feature set mismatch,"
index 83097c3832d129228226dbdcc3e2f2d8af188671..23095d5e019940b245c2577ce2b00fd64d61f0bb 100644 (file)
@@ -2517,7 +2517,7 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata,
 }
 
 static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
-                                        bool assoc)
+                                        bool assoc, bool abandon)
 {
        struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data;
 
@@ -2539,6 +2539,9 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
                mutex_lock(&sdata->local->mtx);
                ieee80211_vif_release_channel(sdata);
                mutex_unlock(&sdata->local->mtx);
+
+               if (abandon)
+                       cfg80211_abandon_assoc(sdata->dev, assoc_data->bss);
        }
 
        kfree(assoc_data);
@@ -2768,7 +2771,7 @@ static void ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
                           bssid, reason_code,
                           ieee80211_get_reason_code_string(reason_code));
 
-               ieee80211_destroy_assoc_data(sdata, false);
+               ieee80211_destroy_assoc_data(sdata, false, true);
 
                cfg80211_rx_mlme_mgmt(sdata->dev, (u8 *)mgmt, len);
                return;
@@ -3173,14 +3176,14 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        if (status_code != WLAN_STATUS_SUCCESS) {
                sdata_info(sdata, "%pM denied association (code=%d)\n",
                           mgmt->sa, status_code);
-               ieee80211_destroy_assoc_data(sdata, false);
+               ieee80211_destroy_assoc_data(sdata, false, false);
                event.u.mlme.status = MLME_DENIED;
                event.u.mlme.reason = status_code;
                drv_event_callback(sdata->local, sdata, &event);
        } else {
                if (!ieee80211_assoc_success(sdata, bss, mgmt, len)) {
                        /* oops -- internal error -- send timeout for now */
-                       ieee80211_destroy_assoc_data(sdata, false);
+                       ieee80211_destroy_assoc_data(sdata, false, false);
                        cfg80211_assoc_timeout(sdata->dev, bss);
                        return;
                }
@@ -3193,7 +3196,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
                 * recalc after assoc_data is NULL but before associated
                 * is set can cause the interface to go idle
                 */
-               ieee80211_destroy_assoc_data(sdata, true);
+               ieee80211_destroy_assoc_data(sdata, true, false);
 
                /* get uapsd queues configuration */
                uapsd_queues = 0;
@@ -3888,7 +3891,7 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
                                .u.mlme.status = MLME_TIMEOUT,
                        };
 
-                       ieee80211_destroy_assoc_data(sdata, false);
+                       ieee80211_destroy_assoc_data(sdata, false, false);
                        cfg80211_assoc_timeout(sdata->dev, bss);
                        drv_event_callback(sdata->local, sdata, &event);
                }
@@ -4029,7 +4032,7 @@ void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata)
                                               WLAN_REASON_DEAUTH_LEAVING,
                                               false, frame_buf);
                if (ifmgd->assoc_data)
-                       ieee80211_destroy_assoc_data(sdata, false);
+                       ieee80211_destroy_assoc_data(sdata, false, true);
                if (ifmgd->auth_data)
                        ieee80211_destroy_auth_data(sdata, false);
                cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
@@ -4905,7 +4908,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
                                               IEEE80211_STYPE_DEAUTH,
                                               req->reason_code, tx,
                                               frame_buf);
-               ieee80211_destroy_assoc_data(sdata, false);
+               ieee80211_destroy_assoc_data(sdata, false, true);
                ieee80211_report_disconnect(sdata, frame_buf,
                                            sizeof(frame_buf), true,
                                            req->reason_code);
@@ -4980,7 +4983,7 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata)
        sdata_lock(sdata);
        if (ifmgd->assoc_data) {
                struct cfg80211_bss *bss = ifmgd->assoc_data->bss;
-               ieee80211_destroy_assoc_data(sdata, false);
+               ieee80211_destroy_assoc_data(sdata, false, false);
                cfg80211_assoc_timeout(sdata->dev, bss);
        }
        if (ifmgd->auth_data)
index 47a967fed8ffc18aff179715c21eb9d7d98eb8b1..47ea169aa0a3d372636d56c2dbd6eb6eb53a919f 100644 (file)
@@ -398,6 +398,7 @@ void cfg80211_sme_disassoc(struct wireless_dev *wdev);
 void cfg80211_sme_deauth(struct wireless_dev *wdev);
 void cfg80211_sme_auth_timeout(struct wireless_dev *wdev);
 void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev);
+void cfg80211_sme_abandon_assoc(struct wireless_dev *wdev);
 
 /* internal helpers */
 bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher);
index fb44fa3bf4efa750298163a15534572c43229b2e..c0e02f72e931fccbdd1b3003dfd0e7fb6a45e197 100644 (file)
@@ -149,6 +149,18 @@ void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss)
 }
 EXPORT_SYMBOL(cfg80211_assoc_timeout);
 
+void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss)
+{
+       struct wireless_dev *wdev = dev->ieee80211_ptr;
+       struct wiphy *wiphy = wdev->wiphy;
+
+       cfg80211_sme_abandon_assoc(wdev);
+
+       cfg80211_unhold_bss(bss_from_pub(bss));
+       cfg80211_put_bss(wiphy, bss);
+}
+EXPORT_SYMBOL(cfg80211_abandon_assoc);
+
 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
index 8020b5b094d4c8fba0c0f2431f8af7d8ecc40dca..18b4a652cf41f2b7f40f0044bd386d72af823ae5 100644 (file)
@@ -39,6 +39,7 @@ struct cfg80211_conn {
                CFG80211_CONN_ASSOCIATING,
                CFG80211_CONN_ASSOC_FAILED,
                CFG80211_CONN_DEAUTH,
+               CFG80211_CONN_ABANDON,
                CFG80211_CONN_CONNECTED,
        } state;
        u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
@@ -204,6 +205,8 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
                cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
                                     NULL, 0,
                                     WLAN_REASON_DEAUTH_LEAVING, false);
+               /* fall through */
+       case CFG80211_CONN_ABANDON:
                /* free directly, disconnected event already sent */
                cfg80211_sme_free(wdev);
                return 0;
@@ -423,6 +426,17 @@ void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev)
        schedule_work(&rdev->conn_work);
 }
 
+void cfg80211_sme_abandon_assoc(struct wireless_dev *wdev)
+{
+       struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+
+       if (!wdev->conn)
+               return;
+
+       wdev->conn->state = CFG80211_CONN_ABANDON;
+       schedule_work(&rdev->conn_work);
+}
+
 static int cfg80211_sme_get_conn_ies(struct wireless_dev *wdev,
                                     const u8 *ies, size_t ies_len,
                                     const u8 **out_ies, size_t *out_ies_len)
index 8275f0e55106bc0055d0a1adfe2a169ad1b54193..4b2f44c20caf8941d150f261074b40d589a10376 100644 (file)
@@ -364,12 +364,14 @@ int dialog_inputbox(WINDOW *main_window,
        WINDOW *prompt_win;
        WINDOW *form_win;
        PANEL *panel;
-       int i, x, y;
+       int i, x, y, lines, columns, win_lines, win_cols;
        int res = -1;
        int cursor_position = strlen(init);
        int cursor_form_win;
        char *result = *resultp;
 
+       getmaxyx(stdscr, lines, columns);
+
        if (strlen(init)+1 > *result_len) {
                *result_len = strlen(init)+1;
                *resultp = result = realloc(result, *result_len);
@@ -386,14 +388,19 @@ int dialog_inputbox(WINDOW *main_window,
        if (title)
                prompt_width = max(prompt_width, strlen(title));
 
+       win_lines = min(prompt_lines+6, lines-2);
+       win_cols = min(prompt_width+7, columns-2);
+       prompt_lines = max(win_lines-6, 0);
+       prompt_width = max(win_cols-7, 0);
+
        /* place dialog in middle of screen */
-       y = (getmaxy(stdscr)-(prompt_lines+4))/2;
-       x = (getmaxx(stdscr)-(prompt_width+4))/2;
+       y = (lines-win_lines)/2;
+       x = (columns-win_cols)/2;
 
        strncpy(result, init, *result_len);
 
        /* create the windows */
-       win = newwin(prompt_lines+6, prompt_width+7, y, x);
+       win = newwin(win_lines, win_cols, y, x);
        prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2);
        form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
        keypad(form_win, TRUE);