]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'trivial/for-next'
authorThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:37:14 +0000 (14:37 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 24 Oct 2013 12:37:14 +0000 (14:37 +0200)
Conflicts:
net/netfilter/xt_set.c

34 files changed:
1  2 
arch/arc/kernel/kprobes.c
arch/s390/kernel/kprobes.c
drivers/base/dma-contiguous.c
drivers/clk/clk-fixed-factor.c
drivers/cpufreq/Kconfig.x86
drivers/cpufreq/exynos-cpufreq.c
drivers/dma/Kconfig
drivers/gpu/drm/drm_irq.c
drivers/input/serio/i8042.c
drivers/md/raid5.h
drivers/media/i2c/s5c73m3/s5c73m3-core.c
drivers/mfd/Kconfig
drivers/mtd/nand/docg4.c
drivers/net/ethernet/mellanox/mlx4/fw.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
drivers/net/wireless/ath/ath10k/pci.c
drivers/regulator/tps65910-regulator.c
drivers/scsi/bfa/bfad.c
drivers/scsi/bnx2i/bnx2i_hwi.c
drivers/scsi/fnic/fnic_main.c
drivers/scsi/hpsa.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/qla2xxx/qla_os.c
fs/btrfs/Kconfig
include/linux/devfreq.h
include/linux/netdevice.h
include/net/bluetooth/l2cap.h
init/Kconfig
kernel/kexec.c
kernel/time/timekeeping.c
mm/Kconfig
mm/slub.c
net/netfilter/xt_set.c

index eb1c2ee5eaf0a4e0b8811092568943ed96be5388,7446c8dcb915ad33e107dd04b80ea527c002a379..42b05046fad9f13b3cffecc1cb041e8febed3840
@@@ -87,13 -87,13 +87,13 @@@ static void __kprobes save_previous_kpr
  
  static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
  {
 -      __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
 +      __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp);
        kcb->kprobe_status = kcb->prev_kprobe.status;
  }
  
  static inline void __kprobes set_current_kprobe(struct kprobe *p)
  {
 -      __get_cpu_var(current_kprobe) = p;
 +      __this_cpu_write(current_kprobe, p);
  }
  
  static void __kprobes resume_execution(struct kprobe *p, unsigned long addr,
@@@ -237,7 -237,7 +237,7 @@@ int __kprobes arc_kprobe_handler(unsign
  
                return 1;
        } else if (kprobe_running()) {
 -              p = __get_cpu_var(current_kprobe);
 +              p = __this_cpu_read(current_kprobe);
                if (p->break_handler && p->break_handler(p, regs)) {
                        setup_singlestep(p, regs);
                        kcb->kprobe_status = KPROBE_HIT_SS;
@@@ -327,7 -327,7 +327,7 @@@ int __kprobes kprobe_fault_handler(stru
                 */
  
                /* We increment the nmissed count for accounting,
-                * we can also use npre/npostfault count for accouting
+                * we can also use npre/npostfault count for accounting
                 * these specific fault cases.
                 */
                kprobes_inc_nmissed_count(cur);
index 59a9c35c4598ae3265c60f69f8f87ca0a1538c2d,4f869b2e63f475764f5a4603fa826b73a5b6c7ec..bc71a7b95af546b94d6ac6ba74c6484bbb261069
  #include <linux/stop_machine.h>
  #include <linux/kdebug.h>
  #include <linux/uaccess.h>
 -#include <asm/cacheflush.h>
 -#include <asm/sections.h>
  #include <linux/module.h>
  #include <linux/slab.h>
  #include <linux/hardirq.h>
 +#include <asm/cacheflush.h>
 +#include <asm/sections.h>
 +#include <asm/dis.h>
  
  DEFINE_PER_CPU(struct kprobe *, current_kprobe);
  DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
  
  struct kretprobe_blackpoint kretprobe_blacklist[] = { };
  
 +DEFINE_INSN_CACHE_OPS(dmainsn);
 +
 +static void *alloc_dmainsn_page(void)
 +{
 +      return (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
 +}
 +
 +static void free_dmainsn_page(void *page)
 +{
 +      free_page((unsigned long)page);
 +}
 +
 +struct kprobe_insn_cache kprobe_dmainsn_slots = {
 +      .mutex = __MUTEX_INITIALIZER(kprobe_dmainsn_slots.mutex),
 +      .alloc = alloc_dmainsn_page,
 +      .free = free_dmainsn_page,
 +      .pages = LIST_HEAD_INIT(kprobe_dmainsn_slots.pages),
 +      .insn_size = MAX_INSN_SIZE,
 +};
 +
  static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn)
  {
 +      if (!is_known_insn((unsigned char *)insn))
 +              return -EINVAL;
        switch (insn[0] >> 8) {
        case 0x0c:      /* bassm */
        case 0x0b:      /* bsm   */
        case 0xac:      /* stnsm */
        case 0xad:      /* stosm */
                return -EINVAL;
 +      case 0xc6:
 +              switch (insn[0] & 0x0f) {
 +              case 0x00: /* exrl   */
 +                      return -EINVAL;
 +              }
        }
        switch (insn[0]) {
        case 0x0101:    /* pr    */
@@@ -128,8 -100,9 +128,8 @@@ static int __kprobes get_fixup_type(kpr
                        fixup |= FIXUP_RETURN_REGISTER;
                break;
        case 0xc0:
 -              if ((insn[0] & 0x0f) == 0x00 || /* larl  */
 -                  (insn[0] & 0x0f) == 0x05)   /* brasl */
 -              fixup |= FIXUP_RETURN_REGISTER;
 +              if ((insn[0] & 0x0f) == 0x05)   /* brasl */
 +                      fixup |= FIXUP_RETURN_REGISTER;
                break;
        case 0xeb:
                switch (insn[2] & 0xff) {
        return fixup;
  }
  
 +static int __kprobes is_insn_relative_long(kprobe_opcode_t *insn)
 +{
 +      /* Check if we have a RIL-b or RIL-c format instruction which
 +       * we need to modify in order to avoid instruction emulation. */
 +      switch (insn[0] >> 8) {
 +      case 0xc0:
 +              if ((insn[0] & 0x0f) == 0x00) /* larl */
 +                      return true;
 +              break;
 +      case 0xc4:
 +              switch (insn[0] & 0x0f) {
 +              case 0x02: /* llhrl  */
 +              case 0x04: /* lghrl  */
 +              case 0x05: /* lhrl   */
 +              case 0x06: /* llghrl */
 +              case 0x07: /* sthrl  */
 +              case 0x08: /* lgrl   */
 +              case 0x0b: /* stgrl  */
 +              case 0x0c: /* lgfrl  */
 +              case 0x0d: /* lrl    */
 +              case 0x0e: /* llgfrl */
 +              case 0x0f: /* strl   */
 +                      return true;
 +              }
 +              break;
 +      case 0xc6:
 +              switch (insn[0] & 0x0f) {
 +              case 0x02: /* pfdrl  */
 +              case 0x04: /* cghrl  */
 +              case 0x05: /* chrl   */
 +              case 0x06: /* clghrl */
 +              case 0x07: /* clhrl  */
 +              case 0x08: /* cgrl   */
 +              case 0x0a: /* clgrl  */
 +              case 0x0c: /* cgfrl  */
 +              case 0x0d: /* crl    */
 +              case 0x0e: /* clgfrl */
 +              case 0x0f: /* clrl   */
 +                      return true;
 +              }
 +              break;
 +      }
 +      return false;
 +}
 +
 +static void __kprobes copy_instruction(struct kprobe *p)
 +{
 +      s64 disp, new_disp;
 +      u64 addr, new_addr;
 +
 +      memcpy(p->ainsn.insn, p->addr, insn_length(p->opcode >> 8));
 +      if (!is_insn_relative_long(p->ainsn.insn))
 +              return;
 +      /*
 +       * For pc-relative instructions in RIL-b or RIL-c format patch the
 +       * RI2 displacement field. We have already made sure that the insn
 +       * slot for the patched instruction is within the same 2GB area
 +       * as the original instruction (either kernel image or module area).
 +       * Therefore the new displacement will always fit.
 +       */
 +      disp = *(s32 *)&p->ainsn.insn[1];
 +      addr = (u64)(unsigned long)p->addr;
 +      new_addr = (u64)(unsigned long)p->ainsn.insn;
 +      new_disp = ((addr + (disp * 2)) - new_addr) / 2;
 +      *(s32 *)&p->ainsn.insn[1] = new_disp;
 +}
 +
 +static inline int is_kernel_addr(void *addr)
 +{
 +      return addr < (void *)_end;
 +}
 +
 +static inline int is_module_addr(void *addr)
 +{
 +#ifdef CONFIG_64BIT
 +      BUILD_BUG_ON(MODULES_LEN > (1UL << 31));
 +      if (addr < (void *)MODULES_VADDR)
 +              return 0;
 +      if (addr > (void *)MODULES_END)
 +              return 0;
 +#endif
 +      return 1;
 +}
 +
 +static int __kprobes s390_get_insn_slot(struct kprobe *p)
 +{
 +      /*
 +       * Get an insn slot that is within the same 2GB area like the original
 +       * instruction. That way instructions with a 32bit signed displacement
 +       * field can be patched and executed within the insn slot.
 +       */
 +      p->ainsn.insn = NULL;
 +      if (is_kernel_addr(p->addr))
 +              p->ainsn.insn = get_dmainsn_slot();
 +      else if (is_module_addr(p->addr))
 +              p->ainsn.insn = get_insn_slot();
 +      return p->ainsn.insn ? 0 : -ENOMEM;
 +}
 +
 +static void __kprobes s390_free_insn_slot(struct kprobe *p)
 +{
 +      if (!p->ainsn.insn)
 +              return;
 +      if (is_kernel_addr(p->addr))
 +              free_dmainsn_slot(p->ainsn.insn, 0);
 +      else
 +              free_insn_slot(p->ainsn.insn, 0);
 +      p->ainsn.insn = NULL;
 +}
 +
  int __kprobes arch_prepare_kprobe(struct kprobe *p)
  {
        if ((unsigned long) p->addr & 0x01)
                return -EINVAL;
 -
        /* Make sure the probe isn't going on a difficult instruction */
        if (is_prohibited_opcode(p->addr))
                return -EINVAL;
 -
 +      if (s390_get_insn_slot(p))
 +              return -ENOMEM;
        p->opcode = *p->addr;
 -      memcpy(p->ainsn.insn, p->addr, ((p->opcode >> 14) + 3) & -2);
 -
 +      copy_instruction(p);
        return 0;
  }
  
@@@ -322,7 -186,6 +322,7 @@@ void __kprobes arch_disarm_kprobe(struc
  
  void __kprobes arch_remove_kprobe(struct kprobe *p)
  {
 +      s390_free_insn_slot(p);
  }
  
  static void __kprobes enable_singlestep(struct kprobe_ctlblk *kcb,
@@@ -611,7 -474,7 +611,7 @@@ static void __kprobes resume_execution(
                ip += (unsigned long) p->addr - (unsigned long) p->ainsn.insn;
  
        if (fixup & FIXUP_BRANCH_NOT_TAKEN) {
 -              int ilen = ((p->ainsn.insn[0] >> 14) + 3) & -2;
 +              int ilen = insn_length(p->ainsn.insn[0] >> 8);
                if (ip - (unsigned long) p->ainsn.insn == ilen)
                        ip = (unsigned long) p->addr + ilen;
        }
@@@ -680,7 -543,7 +680,7 @@@ static int __kprobes kprobe_trap_handle
        case KPROBE_HIT_SSDONE:
                /*
                 * We increment the nmissed count for accounting,
-                * we can also use npre/npostfault count for accouting
+                * we can also use npre/npostfault count for accounting
                 * these specific fault cases.
                 */
                kprobes_inc_nmissed_count(p);
index 99802d6f3c60f603efcff5d342ba0c9f4c937ccd,2d730fdad7a30c022f9cde0e3f8f47dce0c13461..165c2c299e579805a1f234aff9d6ccf6d0c1666c
@@@ -49,7 -49,7 +49,7 @@@ struct cma *dma_contiguous_default_area
  
  /*
   * Default global CMA area size can be defined in kernel's .config.
-  * This is usefull mainly for distro maintainers to create a kernel
+  * This is useful mainly for distro maintainers to create a kernel
   * that works correctly for most supported systems.
   * The size can be set in bytes or as a percentage of the total memory
   * in the system.
@@@ -96,7 -96,7 +96,7 @@@ static inline __maybe_unused phys_addr_
  #endif
  
  /**
 - * dma_contiguous_reserve() - reserve area for contiguous memory handling
 + * dma_contiguous_reserve() - reserve area(s) for contiguous memory handling
   * @limit: End address of the reserved memory (optional, 0 for any).
   *
   * This function reserves memory from early allocator. It should be
@@@ -124,29 -124,22 +124,29 @@@ void __init dma_contiguous_reserve(phys
  #endif
        }
  
 -      if (selected_size) {
 +      if (selected_size && !dma_contiguous_default_area) {
                pr_debug("%s: reserving %ld MiB for global area\n", __func__,
                         (unsigned long)selected_size / SZ_1M);
  
 -              dma_declare_contiguous(NULL, selected_size, 0, limit);
 +              dma_contiguous_reserve_area(selected_size, 0, limit,
 +                                          &dma_contiguous_default_area);
        }
  };
  
  static DEFINE_MUTEX(cma_mutex);
  
 -static int __init cma_activate_area(unsigned long base_pfn, unsigned long count)
 +static int __init cma_activate_area(struct cma *cma)
  {
 -      unsigned long pfn = base_pfn;
 -      unsigned i = count >> pageblock_order;
 +      int bitmap_size = BITS_TO_LONGS(cma->count) * sizeof(long);
 +      unsigned long base_pfn = cma->base_pfn, pfn = base_pfn;
 +      unsigned i = cma->count >> pageblock_order;
        struct zone *zone;
  
 +      cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
 +
 +      if (!cma->bitmap)
 +              return -ENOMEM;
 +
        WARN_ON_ONCE(!pfn_valid(pfn));
        zone = page_zone(pfn_to_page(pfn));
  
                }
                init_cma_reserved_pageblock(pfn_to_page(base_pfn));
        } while (--i);
 -      return 0;
 -}
 -
 -static struct cma * __init cma_create_area(unsigned long base_pfn,
 -                                   unsigned long count)
 -{
 -      int bitmap_size = BITS_TO_LONGS(count) * sizeof(long);
 -      struct cma *cma;
 -      int ret = -ENOMEM;
 -
 -      pr_debug("%s(base %08lx, count %lx)\n", __func__, base_pfn, count);
 -
 -      cma = kmalloc(sizeof *cma, GFP_KERNEL);
 -      if (!cma)
 -              return ERR_PTR(-ENOMEM);
 -
 -      cma->base_pfn = base_pfn;
 -      cma->count = count;
 -      cma->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
  
 -      if (!cma->bitmap)
 -              goto no_mem;
 -
 -      ret = cma_activate_area(base_pfn, count);
 -      if (ret)
 -              goto error;
 -
 -      pr_debug("%s: returned %p\n", __func__, (void *)cma);
 -      return cma;
 -
 -error:
 -      kfree(cma->bitmap);
 -no_mem:
 -      kfree(cma);
 -      return ERR_PTR(ret);
 +      return 0;
  }
  
 -static struct cma_reserved {
 -      phys_addr_t start;
 -      unsigned long size;
 -      struct device *dev;
 -} cma_reserved[MAX_CMA_AREAS] __initdata;
 -static unsigned cma_reserved_count __initdata;
 +static struct cma cma_areas[MAX_CMA_AREAS];
 +static unsigned cma_area_count;
  
  static int __init cma_init_reserved_areas(void)
  {
 -      struct cma_reserved *r = cma_reserved;
 -      unsigned i = cma_reserved_count;
 -
 -      pr_debug("%s()\n", __func__);
 +      int i;
  
 -      for (; i; --i, ++r) {
 -              struct cma *cma;
 -              cma = cma_create_area(PFN_DOWN(r->start),
 -                                    r->size >> PAGE_SHIFT);
 -              if (!IS_ERR(cma))
 -                      dev_set_cma_area(r->dev, cma);
 +      for (i = 0; i < cma_area_count; i++) {
 +              int ret = cma_activate_area(&cma_areas[i]);
 +              if (ret)
 +                      return ret;
        }
 +
        return 0;
  }
  core_initcall(cma_init_reserved_areas);
  
  /**
 - * dma_declare_contiguous() - reserve area for contiguous memory handling
 - *                          for particular device
 - * @dev:   Pointer to device structure.
 - * @size:  Size of the reserved memory.
 - * @base:  Start address of the reserved memory (optional, 0 for any).
 + * dma_contiguous_reserve_area() - reserve custom contiguous area
 + * @size: Size of the reserved area (in bytes),
 + * @base: Base address of the reserved area optional, use 0 for any
   * @limit: End address of the reserved memory (optional, 0 for any).
 + * @res_cma: Pointer to store the created cma region.
   *
 - * This function reserves memory for specified device. It should be
 - * called by board specific code when early allocator (memblock or bootmem)
 - * is still activate.
 + * This function reserves memory from early allocator. It should be
 + * called by arch specific code once the early allocator (memblock or bootmem)
 + * has been activated and all other subsystems have already allocated/reserved
 + * memory. This function allows to create custom reserved areas for specific
 + * devices.
   */
 -int __init dma_declare_contiguous(struct device *dev, phys_addr_t size,
 -                                phys_addr_t base, phys_addr_t limit)
 +int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
 +                                     phys_addr_t limit, struct cma **res_cma)
  {
 -      struct cma_reserved *r = &cma_reserved[cma_reserved_count];
 +      struct cma *cma = &cma_areas[cma_area_count];
        phys_addr_t alignment;
 +      int ret = 0;
  
        pr_debug("%s(size %lx, base %08lx, limit %08lx)\n", __func__,
                 (unsigned long)size, (unsigned long)base,
                 (unsigned long)limit);
  
        /* Sanity checks */
 -      if (cma_reserved_count == ARRAY_SIZE(cma_reserved)) {
 +      if (cma_area_count == ARRAY_SIZE(cma_areas)) {
                pr_err("Not enough slots for CMA reserved regions!\n");
                return -ENOSPC;
        }
        if (base) {
                if (memblock_is_region_reserved(base, size) ||
                    memblock_reserve(base, size) < 0) {
 -                      base = -EBUSY;
 +                      ret = -EBUSY;
                        goto err;
                }
        } else {
                 */
                phys_addr_t addr = __memblock_alloc_base(size, alignment, limit);
                if (!addr) {
 -                      base = -ENOMEM;
 +                      ret = -ENOMEM;
                        goto err;
                } else {
                        base = addr;
         * Each reserved area must be initialised later, when more kernel
         * subsystems (like slab allocator) are available.
         */
 -      r->start = base;
 -      r->size = size;
 -      r->dev = dev;
 -      cma_reserved_count++;
 +      cma->base_pfn = PFN_DOWN(base);
 +      cma->count = size >> PAGE_SHIFT;
 +      *res_cma = cma;
 +      cma_area_count++;
 +
        pr_info("CMA: reserved %ld MiB at %08lx\n", (unsigned long)size / SZ_1M,
                (unsigned long)base);
  
        return 0;
  err:
        pr_err("CMA: failed to reserve %ld MiB\n", (unsigned long)size / SZ_1M);
 -      return base;
 +      return ret;
  }
  
  /**
index 0e1d89b4321b7de9b4bcb49e96f1363c9498e44c,47bdfca6a4ece30ddad3147b09455203231de0e2..d9e3f671c2ea634012982c2228493cba8eb71903
@@@ -97,8 -97,6 +97,8 @@@ struct clk *clk_register_fixed_factor(s
  
        return clk;
  }
 +EXPORT_SYMBOL_GPL(clk_register_fixed_factor);
 +
  #ifdef CONFIG_OF
  /**
   * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock
@@@ -117,7 -115,7 +117,7 @@@ void __init of_fixed_factor_clk_setup(s
        }
  
        if (of_property_read_u32(node, "clock-mult", &mult)) {
-               pr_err("%s Fixed factor clock <%s> must have a clokc-mult property\n",
+               pr_err("%s Fixed factor clock <%s> must have a clock-mult property\n",
                        __func__, node->name);
                return;
        }
index 6897ad85b0467a8200c3a529e5dee14344c2afbf,b80bb4d7d6b48cf05864ec1232d7e98a654a1103..d369349eeaab2df6fe768469470ad6de39583889
@@@ -31,6 -31,7 +31,6 @@@ config X86_PCC_CPUFRE
  
  config X86_ACPI_CPUFREQ
        tristate "ACPI Processor P-States driver"
 -      select CPU_FREQ_TABLE
        depends on ACPI_PROCESSOR
        help
          This driver adds a CPUFreq driver which utilizes the ACPI
@@@ -59,6 -60,7 +59,6 @@@ config X86_ACPI_CPUFREQ_CP
  
  config ELAN_CPUFREQ
        tristate "AMD Elan SC400 and SC410"
 -      select CPU_FREQ_TABLE
        depends on MELAN
        ---help---
          This adds the CPUFreq driver for AMD Elan SC400 and SC410
@@@ -74,6 -76,7 +74,6 @@@
  
  config SC520_CPUFREQ
        tristate "AMD Elan SC520"
 -      select CPU_FREQ_TABLE
        depends on MELAN
        ---help---
          This adds the CPUFreq driver for AMD Elan SC520 processor.
@@@ -85,6 -88,7 +85,6 @@@
  
  config X86_POWERNOW_K6
        tristate "AMD Mobile K6-2/K6-3 PowerNow!"
 -      select CPU_FREQ_TABLE
        depends on X86_32
        help
          This adds the CPUFreq driver for mobile AMD K6-2+ and mobile
  
  config X86_POWERNOW_K7
        tristate "AMD Mobile Athlon/Duron PowerNow!"
 -      select CPU_FREQ_TABLE
        depends on X86_32
        help
          This adds the CPUFreq driver for mobile AMD K7 mobile processors.
@@@ -113,6 -118,7 +113,6 @@@ config X86_POWERNOW_K7_ACP
  
  config X86_POWERNOW_K8
        tristate "AMD Opteron/Athlon64 PowerNow!"
 -      select CPU_FREQ_TABLE
        depends on ACPI && ACPI_PROCESSOR && X86_ACPI_CPUFREQ
        help
          This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors.
  config X86_AMD_FREQ_SENSITIVITY
        tristate "AMD frequency sensitivity feedback powersave bias"
        depends on CPU_FREQ_GOV_ONDEMAND && X86_ACPI_CPUFREQ && CPU_SUP_AMD
 -      select CPU_FREQ_TABLE
        help
          This adds AMD-specific powersave bias function to the ondemand
          governor, which allows it to make more power-conscious frequency
-         change decisions based on feedback from hardware (availble on AMD
+         change decisions based on feedback from hardware (available on AMD
          Family 16h and above).
  
          Hardware feedback tells software how "sensitive" to frequency changes
@@@ -153,6 -160,7 +153,6 @@@ config X86_GX_SUSPMO
  
  config X86_SPEEDSTEP_CENTRINO
        tristate "Intel Enhanced SpeedStep (deprecated)"
 -      select CPU_FREQ_TABLE
        select X86_SPEEDSTEP_CENTRINO_TABLE if X86_32
        depends on X86_32 || (X86_64 && ACPI_PROCESSOR)
        help
@@@ -182,6 -190,7 +182,6 @@@ config X86_SPEEDSTEP_CENTRINO_TABL
  
  config X86_SPEEDSTEP_ICH
        tristate "Intel Speedstep on ICH-M chipsets (ioport interface)"
 -      select CPU_FREQ_TABLE
        depends on X86_32
        help
          This adds the CPUFreq driver for certain mobile Intel Pentium III
  
  config X86_SPEEDSTEP_SMI
        tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)"
 -      select CPU_FREQ_TABLE
        depends on X86_32
        help
          This adds the CPUFreq driver for certain mobile Intel Pentium III
  
  config X86_P4_CLOCKMOD
        tristate "Intel Pentium 4 clock modulation"
 -      select CPU_FREQ_TABLE
        help
          This adds the CPUFreq driver for Intel Pentium 4 / XEON
          processors.  When enabled it will lower CPU temperature by skipping
@@@ -248,6 -259,7 +248,6 @@@ config X86_LONGRU
  
  config X86_LONGHAUL
        tristate "VIA Cyrix III Longhaul"
 -      select CPU_FREQ_TABLE
        depends on X86_32 && ACPI_PROCESSOR
        help
          This adds the CPUFreq driver for VIA Samuel/CyrixIII,
  
  config X86_E_POWERSAVER
        tristate "VIA C7 Enhanced PowerSaver (DANGEROUS)"
 -      select CPU_FREQ_TABLE
        depends on X86_32 && ACPI_PROCESSOR
        help
          This adds the CPUFreq driver for VIA C7 processors.  However, this driver
index 3e4af676f43d79fba9c704049858e5c7026f5dac,b4afd078fe0571d28c0dc647db8589c7aab31eae..95aa166bde83ab602d3ff5763c05961980f9ab02
@@@ -31,6 -31,12 +31,6 @@@ static unsigned int locking_frequency
  static bool frequency_locked;
  static DEFINE_MUTEX(cpufreq_lock);
  
 -static int exynos_verify_speed(struct cpufreq_policy *policy)
 -{
 -      return cpufreq_frequency_table_verify(policy,
 -                                            exynos_info->freq_table);
 -}
 -
  static unsigned int exynos_getspeed(unsigned int cpu)
  {
        return clk_get_rate(exynos_info->cpu_clk) / 1000;
@@@ -71,7 -77,7 +71,7 @@@ static int exynos_cpufreq_scale(unsigne
        /*
         * The policy max have been changed so that we cannot get proper
         * old_index with cpufreq_frequency_table_target(). Thus, ignore
-        * policy and get the index from the raw freqeuncy table.
+        * policy and get the index from the raw frequency table.
         */
        old_index = exynos_cpufreq_get_index(freqs.old);
        if (old_index < 0) {
@@@ -135,7 -141,7 +135,7 @@@ post_notify
        if ((freqs.new < freqs.old) ||
           ((freqs.new > freqs.old) && safe_arm_volt)) {
                /* down the voltage after frequency change */
 -              regulator_set_voltage(arm_regulator, arm_volt,
 +              ret = regulator_set_voltage(arm_regulator, arm_volt,
                                arm_volt);
                if (ret) {
                        pr_err("%s: failed to set cpu voltage to %d\n",
@@@ -241,18 -247,38 +241,18 @@@ static struct notifier_block exynos_cpu
  
  static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy)
  {
 -      policy->cur = policy->min = policy->max = exynos_getspeed(policy->cpu);
 -
 -      cpufreq_frequency_table_get_attr(exynos_info->freq_table, policy->cpu);
 -
 -      /* set the transition latency value */
 -      policy->cpuinfo.transition_latency = 100000;
 -
 -      cpumask_setall(policy->cpus);
 -
 -      return cpufreq_frequency_table_cpuinfo(policy, exynos_info->freq_table);
 +      return cpufreq_generic_init(policy, exynos_info->freq_table, 100000);
  }
  
 -static int exynos_cpufreq_cpu_exit(struct cpufreq_policy *policy)
 -{
 -      cpufreq_frequency_table_put_attr(policy->cpu);
 -      return 0;
 -}
 -
 -static struct freq_attr *exynos_cpufreq_attr[] = {
 -      &cpufreq_freq_attr_scaling_available_freqs,
 -      NULL,
 -};
 -
  static struct cpufreq_driver exynos_driver = {
        .flags          = CPUFREQ_STICKY,
 -      .verify         = exynos_verify_speed,
 +      .verify         = cpufreq_generic_frequency_table_verify,
        .target         = exynos_target,
        .get            = exynos_getspeed,
        .init           = exynos_cpufreq_cpu_init,
 -      .exit           = exynos_cpufreq_cpu_exit,
 +      .exit           = cpufreq_generic_exit,
        .name           = "exynos_cpufreq",
 -      .attr           = exynos_cpufreq_attr,
 +      .attr           = cpufreq_generic_attr,
  #ifdef CONFIG_PM
        .suspend        = exynos_cpufreq_suspend,
        .resume         = exynos_cpufreq_resume,
diff --combined drivers/dma/Kconfig
index f238cfd33847ec3c5333158ea39dac72245c8eee,6ada8b33e46a1c6f66fce9bd5d81a6c9898089da..fcba96cce6477024ccd6df9cf55beba87fa22949
@@@ -198,7 -198,6 +198,7 @@@ config TI_EDM
        depends on ARCH_DAVINCI || ARCH_OMAP
        select DMA_ENGINE
        select DMA_VIRTUAL_CHANNELS
 +      select TI_PRIV_EDMA
        default n
        help
          Enable support for the TI EDMA controller. This DMA
@@@ -301,7 -300,7 +301,7 @@@ config MMP_PDM
        depends on (ARCH_MMP || ARCH_PXA)
        select DMA_ENGINE
        help
-         Support the MMP PDMA engine for PXA and MMP platfrom.
+         Support the MMP PDMA engine for PXA and MMP platform.
  
  config DMA_JZ4740
        tristate "JZ4740 DMA support"
        select DMA_ENGINE
        select DMA_VIRTUAL_CHANNELS
  
 +config K3_DMA
 +      tristate "Hisilicon K3 DMA support"
 +      depends on ARCH_HI3xxx
 +      select DMA_ENGINE
 +      select DMA_VIRTUAL_CHANNELS
 +      help
 +        Support the DMA engine for Hisilicon K3 platform
 +        devices.
 +
  config DMA_ENGINE
        bool
  
index f9af048828ea16136752a29b982ae28add4ff226,062dc22a66733b13b7e4ccc9c3fccd7ef256ce81..c8226e1dd99d47a828b82c86225e064d77e73a7b
@@@ -43,8 -43,9 +43,8 @@@
  #include <linux/export.h>
  
  /* Access macro for slots in vblank timestamp ringbuffer. */
 -#define vblanktimestamp(dev, crtc, count) ( \
 -      (dev)->_vblank_time[(crtc) * DRM_VBLANKTIME_RBSIZE + \
 -      ((count) % DRM_VBLANKTIME_RBSIZE)])
 +#define vblanktimestamp(dev, crtc, count) \
 +      ((dev)->vblank[crtc].time[(count) % DRM_VBLANKTIME_RBSIZE])
  
  /* Retry timestamp calculation up to 3 times to satisfy
   * drm_timestamp_precision before giving up.
@@@ -88,7 -89,8 +88,7 @@@ int drm_irq_by_busid(struct drm_device 
   */
  static void clear_vblank_timestamps(struct drm_device *dev, int crtc)
  {
 -      memset(&dev->_vblank_time[crtc * DRM_VBLANKTIME_RBSIZE], 0,
 -              DRM_VBLANKTIME_RBSIZE * sizeof(struct timeval));
 +      memset(dev->vblank[crtc].time, 0, sizeof(dev->vblank[crtc].time));
  }
  
  /*
@@@ -113,7 -115,7 +113,7 @@@ static void vblank_disable_and_save(str
        spin_lock_irqsave(&dev->vblank_time_lock, irqflags);
  
        dev->driver->disable_vblank(dev, crtc);
 -      dev->vblank_enabled[crtc] = 0;
 +      dev->vblank[crtc].enabled = false;
  
        /* No further vblank irq's will be processed after
         * this point. Get current hardware vblank count and
         * delayed gpu counter increment.
         */
        do {
 -              dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc);
 +              dev->vblank[crtc].last = dev->driver->get_vblank_counter(dev, crtc);
                vblrc = drm_get_last_vbltimestamp(dev, crtc, &tvblank, 0);
 -      } while (dev->last_vblank[crtc] != dev->driver->get_vblank_counter(dev, crtc) && (--count) && vblrc);
 +      } while (dev->vblank[crtc].last != dev->driver->get_vblank_counter(dev, crtc) && (--count) && vblrc);
  
        if (!count)
                vblrc = 0;
        /* Compute time difference to stored timestamp of last vblank
         * as updated by last invocation of drm_handle_vblank() in vblank irq.
         */
 -      vblcount = atomic_read(&dev->_vblank_count[crtc]);
 +      vblcount = atomic_read(&dev->vblank[crtc].count);
        diff_ns = timeval_to_ns(&tvblank) -
                  timeval_to_ns(&vblanktimestamp(dev, crtc, vblcount));
  
         * hope for the best.
         */
        if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) {
 -              atomic_inc(&dev->_vblank_count[crtc]);
 +              atomic_inc(&dev->vblank[crtc].count);
                smp_mb__after_atomic_inc();
        }
  
@@@ -176,8 -178,8 +176,8 @@@ static void vblank_disable_fn(unsigned 
  
        for (i = 0; i < dev->num_crtcs; i++) {
                spin_lock_irqsave(&dev->vbl_lock, irqflags);
 -              if (atomic_read(&dev->vblank_refcount[i]) == 0 &&
 -                  dev->vblank_enabled[i]) {
 +              if (atomic_read(&dev->vblank[i].refcount) == 0 &&
 +                  dev->vblank[i].enabled) {
                        DRM_DEBUG("disabling vblank on crtc %d\n", i);
                        vblank_disable_and_save(dev, i);
                }
@@@ -195,7 -197,14 +195,7 @@@ void drm_vblank_cleanup(struct drm_devi
  
        vblank_disable_fn((unsigned long)dev);
  
 -      kfree(dev->vbl_queue);
 -      kfree(dev->_vblank_count);
 -      kfree(dev->vblank_refcount);
 -      kfree(dev->vblank_enabled);
 -      kfree(dev->last_vblank);
 -      kfree(dev->last_vblank_wait);
 -      kfree(dev->vblank_inmodeset);
 -      kfree(dev->_vblank_time);
 +      kfree(dev->vblank);
  
        dev->num_crtcs = 0;
  }
@@@ -212,12 -221,40 +212,12 @@@ int drm_vblank_init(struct drm_device *
  
        dev->num_crtcs = num_crtcs;
  
 -      dev->vbl_queue = kmalloc(sizeof(wait_queue_head_t) * num_crtcs,
 -                               GFP_KERNEL);
 -      if (!dev->vbl_queue)
 +      dev->vblank = kcalloc(num_crtcs, sizeof(*dev->vblank), GFP_KERNEL);
 +      if (!dev->vblank)
                goto err;
  
 -      dev->_vblank_count = kmalloc(sizeof(atomic_t) * num_crtcs, GFP_KERNEL);
 -      if (!dev->_vblank_count)
 -              goto err;
 -
 -      dev->vblank_refcount = kmalloc(sizeof(atomic_t) * num_crtcs,
 -                                     GFP_KERNEL);
 -      if (!dev->vblank_refcount)
 -              goto err;
 -
 -      dev->vblank_enabled = kcalloc(num_crtcs, sizeof(int), GFP_KERNEL);
 -      if (!dev->vblank_enabled)
 -              goto err;
 -
 -      dev->last_vblank = kcalloc(num_crtcs, sizeof(u32), GFP_KERNEL);
 -      if (!dev->last_vblank)
 -              goto err;
 -
 -      dev->last_vblank_wait = kcalloc(num_crtcs, sizeof(u32), GFP_KERNEL);
 -      if (!dev->last_vblank_wait)
 -              goto err;
 -
 -      dev->vblank_inmodeset = kcalloc(num_crtcs, sizeof(int), GFP_KERNEL);
 -      if (!dev->vblank_inmodeset)
 -              goto err;
 -
 -      dev->_vblank_time = kcalloc(num_crtcs * DRM_VBLANKTIME_RBSIZE,
 -                                  sizeof(struct timeval), GFP_KERNEL);
 -      if (!dev->_vblank_time)
 -              goto err;
 +      for (i = 0; i < num_crtcs; i++)
 +              init_waitqueue_head(&dev->vblank[i].queue);
  
        DRM_INFO("Supports vblank timestamp caching Rev 1 (10.10.2010).\n");
  
        else
                DRM_INFO("No driver support for vblank timestamp query.\n");
  
 -      /* Zero per-crtc vblank stuff */
 -      for (i = 0; i < num_crtcs; i++) {
 -              init_waitqueue_head(&dev->vbl_queue[i]);
 -              atomic_set(&dev->_vblank_count[i], 0);
 -              atomic_set(&dev->vblank_refcount[i], 0);
 -      }
 +      dev->vblank_disable_allowed = false;
  
 -      dev->vblank_disable_allowed = 0;
        return 0;
  
  err:
@@@ -293,7 -336,7 +293,7 @@@ int drm_irq_install(struct drm_device *
                mutex_unlock(&dev->struct_mutex);
                return -EBUSY;
        }
 -      dev->irq_enabled = 1;
 +      dev->irq_enabled = true;
        mutex_unlock(&dev->struct_mutex);
  
        DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev));
  
        if (ret < 0) {
                mutex_lock(&dev->struct_mutex);
 -              dev->irq_enabled = 0;
 +              dev->irq_enabled = false;
                mutex_unlock(&dev->struct_mutex);
                return ret;
        }
  
        if (ret < 0) {
                mutex_lock(&dev->struct_mutex);
 -              dev->irq_enabled = 0;
 +              dev->irq_enabled = false;
                mutex_unlock(&dev->struct_mutex);
                if (!drm_core_check_feature(dev, DRIVER_MODESET))
                        vga_client_register(dev->pdev, NULL, NULL, NULL);
@@@ -351,15 -394,14 +351,15 @@@ EXPORT_SYMBOL(drm_irq_install)
  int drm_irq_uninstall(struct drm_device *dev)
  {
        unsigned long irqflags;
 -      int irq_enabled, i;
 +      bool irq_enabled;
 +      int i;
  
        if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
                return -EINVAL;
  
        mutex_lock(&dev->struct_mutex);
        irq_enabled = dev->irq_enabled;
 -      dev->irq_enabled = 0;
 +      dev->irq_enabled = false;
        mutex_unlock(&dev->struct_mutex);
  
        /*
        if (dev->num_crtcs) {
                spin_lock_irqsave(&dev->vbl_lock, irqflags);
                for (i = 0; i < dev->num_crtcs; i++) {
 -                      DRM_WAKEUP(&dev->vbl_queue[i]);
 -                      dev->vblank_enabled[i] = 0;
 -                      dev->last_vblank[i] =
 +                      DRM_WAKEUP(&dev->vblank[i].queue);
 +                      dev->vblank[i].enabled = false;
 +                      dev->vblank[i].last =
                                dev->driver->get_vblank_counter(dev, i);
                }
                spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
@@@ -455,8 -497,8 +455,8 @@@ void drm_calc_timestamping_constants(st
        /* Dot clock in Hz: */
        dotclock = (u64) crtc->hwmode.clock * 1000;
  
-       /* Fields of interlaced scanout modes are only halve a frame duration.
-        * Double the dotclock to get halve the frame-/line-/pixelduration.
+       /* Fields of interlaced scanout modes are only half a frame duration.
+        * Double the dotclock to get half the frame-/line-/pixelduration.
         */
        if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE)
                dotclock *= 2;
@@@ -753,7 -795,7 +753,7 @@@ EXPORT_SYMBOL(drm_get_last_vbltimestamp
   */
  u32 drm_vblank_count(struct drm_device *dev, int crtc)
  {
 -      return atomic_read(&dev->_vblank_count[crtc]);
 +      return atomic_read(&dev->vblank[crtc].count);
  }
  EXPORT_SYMBOL(drm_vblank_count);
  
@@@ -782,10 -824,10 +782,10 @@@ u32 drm_vblank_count_and_time(struct dr
         * a seqlock.
         */
        do {
 -              cur_vblank = atomic_read(&dev->_vblank_count[crtc]);
 +              cur_vblank = atomic_read(&dev->vblank[crtc].count);
                *vblanktime = vblanktimestamp(dev, crtc, cur_vblank);
                smp_rmb();
 -      } while (cur_vblank != atomic_read(&dev->_vblank_count[crtc]));
 +      } while (cur_vblank != atomic_read(&dev->vblank[crtc].count));
  
        return cur_vblank;
  }
@@@ -872,12 -914,12 +872,12 @@@ static void drm_update_vblank_count(str
        } while (cur_vblank != dev->driver->get_vblank_counter(dev, crtc));
  
        /* Deal with counter wrap */
 -      diff = cur_vblank - dev->last_vblank[crtc];
 -      if (cur_vblank < dev->last_vblank[crtc]) {
 +      diff = cur_vblank - dev->vblank[crtc].last;
 +      if (cur_vblank < dev->vblank[crtc].last) {
                diff += dev->max_vblank_count;
  
                DRM_DEBUG("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n",
 -                        crtc, dev->last_vblank[crtc], cur_vblank, diff);
 +                        crtc, dev->vblank[crtc].last, cur_vblank, diff);
        }
  
        DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n",
         * reinitialize delayed at next vblank interrupt in that case.
         */
        if (rc) {
 -              tslot = atomic_read(&dev->_vblank_count[crtc]) + diff;
 +              tslot = atomic_read(&dev->vblank[crtc].count) + diff;
                vblanktimestamp(dev, crtc, tslot) = t_vblank;
        }
  
        smp_mb__before_atomic_inc();
 -      atomic_add(diff, &dev->_vblank_count[crtc]);
 +      atomic_add(diff, &dev->vblank[crtc].count);
        smp_mb__after_atomic_inc();
  }
  
@@@ -915,9 -957,9 +915,9 @@@ int drm_vblank_get(struct drm_device *d
  
        spin_lock_irqsave(&dev->vbl_lock, irqflags);
        /* Going from 0->1 means we have to enable interrupts again */
 -      if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) {
 +      if (atomic_add_return(1, &dev->vblank[crtc].refcount) == 1) {
                spin_lock_irqsave(&dev->vblank_time_lock, irqflags2);
 -              if (!dev->vblank_enabled[crtc]) {
 +              if (!dev->vblank[crtc].enabled) {
                        /* Enable vblank irqs under vblank_time_lock protection.
                         * All vblank count & timestamp updates are held off
                         * until we are done reinitializing master counter and
                        DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n",
                                  crtc, ret);
                        if (ret)
 -                              atomic_dec(&dev->vblank_refcount[crtc]);
 +                              atomic_dec(&dev->vblank[crtc].refcount);
                        else {
 -                              dev->vblank_enabled[crtc] = 1;
 +                              dev->vblank[crtc].enabled = true;
                                drm_update_vblank_count(dev, crtc);
                        }
                }
                spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags2);
        } else {
 -              if (!dev->vblank_enabled[crtc]) {
 -                      atomic_dec(&dev->vblank_refcount[crtc]);
 +              if (!dev->vblank[crtc].enabled) {
 +                      atomic_dec(&dev->vblank[crtc].refcount);
                        ret = -EINVAL;
                }
        }
@@@ -957,10 -999,10 +957,10 @@@ EXPORT_SYMBOL(drm_vblank_get)
   */
  void drm_vblank_put(struct drm_device *dev, int crtc)
  {
 -      BUG_ON(atomic_read(&dev->vblank_refcount[crtc]) == 0);
 +      BUG_ON(atomic_read(&dev->vblank[crtc].refcount) == 0);
  
        /* Last user schedules interrupt disable */
 -      if (atomic_dec_and_test(&dev->vblank_refcount[crtc]) &&
 +      if (atomic_dec_and_test(&dev->vblank[crtc].refcount) &&
            (drm_vblank_offdelay > 0))
                mod_timer(&dev->vblank_disable_timer,
                          jiffies + ((drm_vblank_offdelay * DRM_HZ)/1000));
@@@ -983,7 -1025,7 +983,7 @@@ void drm_vblank_off(struct drm_device *
  
        spin_lock_irqsave(&dev->vbl_lock, irqflags);
        vblank_disable_and_save(dev, crtc);
 -      DRM_WAKEUP(&dev->vbl_queue[crtc]);
 +      DRM_WAKEUP(&dev->vblank[crtc].queue);
  
        /* Send any queued vblank events, lest the natives grow disquiet */
        seq = drm_vblank_count_and_time(dev, crtc, &now);
@@@ -1025,10 -1067,10 +1025,10 @@@ void drm_vblank_pre_modeset(struct drm_
         * to avoid corrupting the count if multiple, mismatch calls occur),
         * so that interrupts remain enabled in the interim.
         */
 -      if (!dev->vblank_inmodeset[crtc]) {
 -              dev->vblank_inmodeset[crtc] = 0x1;
 +      if (!dev->vblank[crtc].inmodeset) {
 +              dev->vblank[crtc].inmodeset = 0x1;
                if (drm_vblank_get(dev, crtc) == 0)
 -                      dev->vblank_inmodeset[crtc] |= 0x2;
 +                      dev->vblank[crtc].inmodeset |= 0x2;
        }
  }
  EXPORT_SYMBOL(drm_vblank_pre_modeset);
@@@ -1041,15 -1083,15 +1041,15 @@@ void drm_vblank_post_modeset(struct drm
        if (!dev->num_crtcs)
                return;
  
 -      if (dev->vblank_inmodeset[crtc]) {
 +      if (dev->vblank[crtc].inmodeset) {
                spin_lock_irqsave(&dev->vbl_lock, irqflags);
 -              dev->vblank_disable_allowed = 1;
 +              dev->vblank_disable_allowed = true;
                spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
  
 -              if (dev->vblank_inmodeset[crtc] & 0x2)
 +              if (dev->vblank[crtc].inmodeset & 0x2)
                        drm_vblank_put(dev, crtc);
  
 -              dev->vblank_inmodeset[crtc] = 0;
 +              dev->vblank[crtc].inmodeset = 0;
        }
  }
  EXPORT_SYMBOL(drm_vblank_post_modeset);
@@@ -1246,8 -1288,8 +1246,8 @@@ int drm_wait_vblank(struct drm_device *
  
        DRM_DEBUG("waiting on vblank count %d, crtc %d\n",
                  vblwait->request.sequence, crtc);
 -      dev->last_vblank_wait[crtc] = vblwait->request.sequence;
 -      DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
 +      dev->vblank[crtc].last_wait = vblwait->request.sequence;
 +      DRM_WAIT_ON(ret, dev->vblank[crtc].queue, 3 * DRM_HZ,
                    (((drm_vblank_count(dev, crtc) -
                       vblwait->request.sequence) <= (1 << 23)) ||
                     !dev->irq_enabled));
@@@ -1325,7 -1367,7 +1325,7 @@@ bool drm_handle_vblank(struct drm_devic
        spin_lock_irqsave(&dev->vblank_time_lock, irqflags);
  
        /* Vblank irq handling disabled. Nothing to do. */
 -      if (!dev->vblank_enabled[crtc]) {
 +      if (!dev->vblank[crtc].enabled) {
                spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
                return false;
        }
         */
  
        /* Get current timestamp and count. */
 -      vblcount = atomic_read(&dev->_vblank_count[crtc]);
 +      vblcount = atomic_read(&dev->vblank[crtc].count);
        drm_get_last_vbltimestamp(dev, crtc, &tvblank, DRM_CALLED_FROM_VBLIRQ);
  
        /* Compute time difference to timestamp of last vblank */
                 * the timestamp computed above.
                 */
                smp_mb__before_atomic_inc();
 -              atomic_inc(&dev->_vblank_count[crtc]);
 +              atomic_inc(&dev->vblank[crtc].count);
                smp_mb__after_atomic_inc();
        } else {
                DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n",
                          crtc, (int) diff_ns);
        }
  
 -      DRM_WAKEUP(&dev->vbl_queue[crtc]);
 +      DRM_WAKEUP(&dev->vblank[crtc].queue);
        drm_handle_vblank_events(dev, crtc);
  
        spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
index 52c9ebf94729ff5bf6531cc7773902ece632d03b,957e387c1cbf693e2e2fce1fb339845b67b71007..020053fa5aaa38fce82b5fc2d6ced8546661c9df
@@@ -223,26 -223,21 +223,26 @@@ static int i8042_flush(void
  {
        unsigned long flags;
        unsigned char data, str;
 -      int i = 0;
 +      int count = 0;
 +      int retval = 0;
  
        spin_lock_irqsave(&i8042_lock, flags);
  
 -      while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) {
 -              udelay(50);
 -              data = i8042_read_data();
 -              i++;
 -              dbg("%02x <- i8042 (flush, %s)\n",
 -                  data, str & I8042_STR_AUXDATA ? "aux" : "kbd");
 +      while ((str = i8042_read_status()) & I8042_STR_OBF) {
 +              if (count++ < I8042_BUFFER_SIZE) {
 +                      udelay(50);
 +                      data = i8042_read_data();
 +                      dbg("%02x <- i8042 (flush, %s)\n",
 +                          data, str & I8042_STR_AUXDATA ? "aux" : "kbd");
 +              } else {
 +                      retval = -EIO;
 +                      break;
 +              }
        }
  
        spin_unlock_irqrestore(&i8042_lock, flags);
  
 -      return i;
 +      return retval;
  }
  
  /*
@@@ -854,7 -849,7 +854,7 @@@ static int __init i8042_check_aux(void
  
  static int i8042_controller_check(void)
  {
 -      if (i8042_flush() == I8042_BUFFER_SIZE) {
 +      if (i8042_flush()) {
                pr_err("No controller found\n");
                return -ENODEV;
        }
@@@ -1036,7 -1031,7 +1036,7 @@@ static void i8042_controller_reset(boo
  /*
   * i8042_panic_blink() will turn the keyboard LEDs on or off and is called
   * when kernel panics. Flashing LEDs is useful for users running X who may
-  * not see the console and will help distingushing panics from "real"
+  * not see the console and will help distinguishing panics from "real"
   * lockups.
   *
   * Note that DELAY has a limit of 10ms so we will not get stuck here
diff --combined drivers/md/raid5.h
index e4407388670a53dc2da94dfdadd3d9cd2188f332,5c9797c7bbe0083c57d2650784fbfc8f3fc2e08a..01ad8ae8f57830a04de4e1e30b731f74660bda62
@@@ -49,7 -49,7 +49,7 @@@
   * can't distinguish between a clean block that has been generated
   * from parity calculations, and a clean block that has been
   * successfully written to the spare ( or to parity when resyncing).
-  * To distingush these states we have a stripe bit STRIPE_INSYNC that
+  * To distinguish these states we have a stripe bit STRIPE_INSYNC that
   * is set whenever a write is scheduled to the spare, or to the parity
   * disc if there is no spare.  A sync request clears this bit, and
   * when we find it set with no buffers locked, we know the sync is
@@@ -197,7 -197,6 +197,7 @@@ enum reconstruct_states 
  struct stripe_head {
        struct hlist_node       hash;
        struct list_head        lru;          /* inactive_list or handle_list */
 +      struct llist_node       release_list;
        struct r5conf           *raid_conf;
        short                   generation;     /* increments with every
                                                 * reshape */
        short                   pd_idx;         /* parity disk index */
        short                   qd_idx;         /* 'Q' disk index for raid6 */
        short                   ddf_layout;/* use DDF ordering to calculate Q */
 +      short                   hash_lock_index;
        unsigned long           state;          /* state flags */
        atomic_t                count;        /* nr of active thread/requests */
        int                     bm_seq; /* sequence number for bitmap flushes */
        enum check_states       check_state;
        enum reconstruct_states reconstruct_state;
        spinlock_t              stripe_lock;
 +      int                     cpu;
 +      struct r5worker_group   *group;
        /**
         * struct stripe_operations
         * @target - STRIPE_OP_COMPUTE_BLK target
@@@ -325,7 -321,6 +325,7 @@@ enum 
        STRIPE_OPS_REQ_PENDING,
        STRIPE_ON_UNPLUG_LIST,
        STRIPE_DISCARD,
 +      STRIPE_ON_RELEASE_LIST,
  };
  
  /*
@@@ -368,32 -363,8 +368,32 @@@ struct disk_info 
        struct md_rdev  *rdev, *replacement;
  };
  
 +/* NOTE NR_STRIPE_HASH_LOCKS must remain below 64.
 + * This is because we sometimes take all the spinlocks
 + * and creating that much locking depth can cause
 + * problems.
 + */
 +#define NR_STRIPE_HASH_LOCKS 8
 +#define STRIPE_HASH_LOCKS_MASK (NR_STRIPE_HASH_LOCKS - 1)
 +
 +struct r5worker {
 +      struct work_struct work;
 +      struct r5worker_group *group;
 +      struct list_head temp_inactive_list[NR_STRIPE_HASH_LOCKS];
 +      bool working;
 +};
 +
 +struct r5worker_group {
 +      struct list_head handle_list;
 +      struct r5conf *conf;
 +      struct r5worker *workers;
 +      int stripes_cnt;
 +};
 +
  struct r5conf {
        struct hlist_head       *stripe_hashtbl;
 +      /* only protect corresponding hash list and inactive_list */
 +      spinlock_t              hash_locks[NR_STRIPE_HASH_LOCKS];
        struct mddev            *mddev;
        int                     chunk_sectors;
        int                     level, algorithm;
        int                     prev_chunk_sectors;
        int                     prev_algo;
        short                   generation; /* increments with every reshape */
 +      seqcount_t              gen_lock;       /* lock against generation changes */
        unsigned long           reshape_checkpoint; /* Time we last updated
                                                     * metadata */
        long long               min_offset_diff; /* minimum difference between
         * Free stripes pool
         */
        atomic_t                active_stripes;
 -      struct list_head        inactive_list;
 +      struct list_head        inactive_list[NR_STRIPE_HASH_LOCKS];
 +      atomic_t                empty_inactive_list_nr;
 +      struct llist_head       released_stripes;
        wait_queue_head_t       wait_for_stripe;
        wait_queue_head_t       wait_for_overlap;
        int                     inactive_blocked;       /* release of inactive stripes blocked,
         * the new thread here until we fully activate the array.
         */
        struct md_thread        *thread;
 +      struct list_head        temp_inactive_list[NR_STRIPE_HASH_LOCKS];
 +      struct r5worker_group   *worker_groups;
 +      int                     group_cnt;
 +      int                     worker_cnt_per_group;
  };
  
  /*
index 1083890ac5a9fa198195ad931f8943f1b67fa340,31f40b3420497497fece6df8a6ea05b5d7e4edf7..6fec9384d86e4877d5b750a9f9a9ceec53e06bde
@@@ -1581,7 -1581,7 +1581,7 @@@ static int s5c73m3_probe(struct i2c_cli
        oif_sd = &state->oif_sd;
  
        v4l2_subdev_init(sd, &s5c73m3_subdev_ops);
 -      sd->owner = client->driver->driver.owner;
 +      sd->owner = client->dev.driver->owner;
        v4l2_set_subdevdata(sd, state);
        strlcpy(sd->name, "S5C73M3", sizeof(sd->name));
  
        if (ret < 0)
                goto out_err;
  
-       v4l2_info(sd, "%s: completed succesfully\n", __func__);
+       v4l2_info(sd, "%s: completed successfully\n", __func__);
        return 0;
  
  out_err:
diff --combined drivers/mfd/Kconfig
index b7c74a73d371fd2885f3084fccb862e35db062aa,a2f12ae69b1d639f25a5801fe26af22f36f7a9fe..62a60caa5d1fe7eb583cb208fef9b96a5b0dd8f0
@@@ -23,22 -23,10 +23,22 @@@ config MFD_AS371
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        help
          Support for the AS3711 PMIC from AMS
  
 +config MFD_AS3722
 +      bool "ams AS3722 Power Management IC"
 +      select MFD_CORE
 +      select REGMAP_I2C
 +      select REGMAP_IRQ
 +      depends on I2C && OF
 +      help
 +        The ams AS3722 is a compact system PMU suitable for mobile phones,
 +        tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down
 +        controllers, 11 LDOs, RTC, automatic battery, temperature and
 +        over current monitoring, GPIOs, ADC and a watchdog.
 +
  config PMIC_ADP5520
        bool "Analog Devices ADP5520/01 MFD PMIC Core Support"
        depends on I2C=y
@@@ -52,7 -40,7 +52,7 @@@
  config MFD_AAT2870_CORE
        bool "AnalogicTech AAT2870"
        select MFD_CORE
 -      depends on I2C=y && GPIOLIB && GENERIC_HARDIRQS
 +      depends on I2C=y && GPIOLIB
        help
          If you say yes here you get support for the AAT2870.
          This driver provides common support for accessing the device,
@@@ -90,7 -78,7 +90,7 @@@ config MFD_CROS_EC_SP
  
  config MFD_ASIC3
        bool "Compaq ASIC3"
 -      depends on GENERIC_HARDIRQS && GPIOLIB && ARM
 +      depends on GPIOLIB && ARM
        select MFD_CORE
         ---help---
          This driver supports the ASIC3 multifunction chip found on many
@@@ -116,7 -104,7 +116,7 @@@ config MFD_DA9052_SP
        select REGMAP_SPI
        select REGMAP_IRQ
        select PMIC_DA9052
 -      depends on SPI_MASTER=y && GENERIC_HARDIRQS
 +      depends on SPI_MASTER=y
        help
          Support for the Dialog Semiconductor DA9052 PMIC
          when controlled using SPI. This driver provides common support
@@@ -128,7 -116,7 +128,7 @@@ config MFD_DA9052_I2
        select REGMAP_I2C
        select REGMAP_IRQ
        select PMIC_DA9052
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        help
          Support for the Dialog Semiconductor DA9052 PMIC
          when controlled using I2C. This driver provides common support
@@@ -140,7 -128,7 +140,7 @@@ config MFD_DA905
        select REGMAP_I2C
        select REGMAP_IRQ
        select MFD_CORE
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        help
          Say yes here for support of Dialog Semiconductor DA9055. This is
          a Power Management IC. This driver provides common support for
          This driver can be built as a module. If built as a module it will be
          called "da9055"
  
 +config MFD_DA9063
 +      bool "Dialog Semiconductor DA9063 PMIC Support"
 +      select MFD_CORE
 +      select REGMAP_I2C
 +      select REGMAP_IRQ
 +      depends on I2C=y
 +      help
 +        Say yes here for support for the Dialog Semiconductor DA9063 PMIC.
 +        This includes the I2C driver and core APIs.
 +        Additional drivers must be enabled in order to use the functionality
 +        of the device.
 +
  config MFD_MC13783
        tristate
  
  config MFD_MC13XXX
        tristate
 -      depends on (SPI_MASTER || I2C) && GENERIC_HARDIRQS
 +      depends on (SPI_MASTER || I2C)
        select MFD_CORE
        select MFD_MC13783
        help
  
  config MFD_MC13XXX_SPI
        tristate "Freescale MC13783 and MC13892 SPI interface"
 -      depends on SPI_MASTER && GENERIC_HARDIRQS
 +      depends on SPI_MASTER
        select REGMAP_SPI
        select MFD_MC13XXX
        help
  
  config MFD_MC13XXX_I2C
        tristate "Freescale MC13892 I2C interface"
 -      depends on I2C && GENERIC_HARDIRQS
 +      depends on I2C
        select REGMAP_I2C
        select MFD_MC13XXX
        help
  
  config HTC_EGPIO
        bool "HTC EGPIO support"
 -      depends on GENERIC_HARDIRQS && GPIOLIB && ARM
 +      depends on GPIOLIB && ARM
        help
            This driver supports the CPLD egpio chip present on
            several HTC phones.  It provides basic support for input
  config HTC_PASIC3
        tristate "HTC PASIC3 LED/DS1WM chip support"
        select MFD_CORE
 -      depends on GENERIC_HARDIRQS
        help
          This core driver provides register access for the LED/DS1WM
          chips labeled "AIC2" and "AIC3", found on HTC Blueangel and
@@@ -221,7 -198,7 +221,7 @@@ config HTC_I2CPL
  
  config LPC_ICH
        tristate "Intel ICH LPC"
 -      depends on PCI && GENERIC_HARDIRQS
 +      depends on PCI
        select MFD_CORE
        help
          The LPC bridge function of the Intel ICH provides support for
  
  config LPC_SCH
        tristate "Intel SCH LPC"
 -      depends on PCI && GENERIC_HARDIRQS
 +      depends on PCI
        select MFD_CORE
        help
          LPC bridge function of the Intel SCH provides support for
@@@ -249,7 -226,7 +249,7 @@@ config MFD_INTEL_MSI
  config MFD_JANZ_CMODIO
        tristate "Janz CMOD-IO PCI MODULbus Carrier Board"
        select MFD_CORE
 -      depends on PCI && GENERIC_HARDIRQS
 +      depends on PCI
        help
          This is the core driver for the Janz CMOD-IO PCI MODULbus
          carrier board. This device is a PCI to MODULbus bridge which may
@@@ -288,7 -265,7 +288,7 @@@ config MFD_KEMPL
  
  config MFD_88PM800
        tristate "Marvell 88PM800"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select REGMAP_I2C
        select REGMAP_IRQ
        select MFD_CORE
  
  config MFD_88PM805
        tristate "Marvell 88PM805"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select REGMAP_I2C
        select REGMAP_IRQ
        select MFD_CORE
  
  config MFD_88PM860X
        bool "Marvell 88PM8606/88PM8607"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select REGMAP_I2C
        select MFD_CORE
        help
  
  config MFD_MAX77686
        bool "Maxim Semiconductor MAX77686 PMIC Support"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        select IRQ_DOMAIN
  
  config MFD_MAX77693
        bool "Maxim Semiconductor MAX77693 PMIC Support"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        help
  config MFD_MAX8907
        tristate "Maxim Semiconductor MAX8907 PMIC Support"
        select MFD_CORE
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select REGMAP_I2C
        select REGMAP_IRQ
        help
  
  config MFD_MAX8925
        bool "Maxim Semiconductor MAX8925 PMIC Support"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        help
          Say yes here to support for Maxim Semiconductor MAX8925. This is
  
  config MFD_MAX8997
        bool "Maxim Semiconductor MAX8997/8966 PMIC Support"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select IRQ_DOMAIN
        help
  
  config MFD_MAX8998
        bool "Maxim Semiconductor MAX8998/National LP3974 PMIC Support"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select IRQ_DOMAIN
        help
  
  config EZX_PCAP
        bool "Motorola EZXPCAP Support"
 -      depends on GENERIC_HARDIRQS && SPI_MASTER
 +      depends on SPI_MASTER
        help
          This enables the PCAP ASIC present on EZX Phones. This is
          needed for MMC, TouchScreen, Sound, USB, etc..
  config MFD_VIPERBOARD
          tristate "Nano River Technologies Viperboard"
        select MFD_CORE
 -      depends on USB && GENERIC_HARDIRQS
 +      depends on USB
        default n
        help
          Say yes here if you want support for Nano River Technologies
  config MFD_RETU
        tristate "Nokia Retu and Tahvo multi-function device"
        select MFD_CORE
 -      depends on I2C && GENERIC_HARDIRQS
 +      depends on I2C
        select REGMAP_IRQ
        help
          Retu and Tahvo are a multi-function devices found on Nokia
@@@ -491,7 -468,7 +491,7 @@@ config MFD_PM8XXX_IR
  config MFD_RDC321X
        tristate "RDC R-321x southbridge"
        select MFD_CORE
 -      depends on PCI && GENERIC_HARDIRQS
 +      depends on PCI
        help
          Say yes here if you want to have support for the RDC R-321x SoC
          southbridge which provides access to GPIOs and Watchdog using the
  
  config MFD_RTSX_PCI
        tristate "Realtek PCI-E card reader"
 -      depends on PCI && GENERIC_HARDIRQS
 +      depends on PCI
        select MFD_CORE
        help
          This supports for Realtek PCI-Express card reader including rts5209,
  
  config MFD_RC5T583
        bool "Ricoh RC5T583 Power Management system device"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        help
  
  config MFD_SEC_CORE
        bool "SAMSUNG Electronics PMIC Series Support"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
@@@ -566,7 -543,7 +566,7 @@@ config MFD_SM501_GPI
  
  config MFD_SMSC
         bool "SMSC ECE1099 series chips"
 -       depends on I2C=y && GENERIC_HARDIRQS
 +       depends on I2C=y
         select MFD_CORE
         select REGMAP_I2C
         help
@@@ -588,7 -565,7 +588,7 @@@ config ABX500_COR
  
  config AB3100_CORE
        bool "ST-Ericsson AB3100 Mixed Signal Circuit core functions"
 -      depends on I2C=y && ABX500_CORE && GENERIC_HARDIRQS
 +      depends on I2C=y && ABX500_CORE
        select MFD_CORE
        default y if ARCH_U300
        help
@@@ -612,7 -589,7 +612,7 @@@ config AB3100_OT
  
  config AB8500_CORE
        bool "ST-Ericsson AB8500 Mixed Signal Power Management chip"
 -      depends on GENERIC_HARDIRQS && ABX500_CORE && MFD_DB8500_PRCMU
 +      depends on ABX500_CORE && MFD_DB8500_PRCMU
        select POWER_SUPPLY
        select MFD_CORE
        select IRQ_DOMAIN
@@@ -650,7 -627,7 +650,7 @@@ config MFD_DB8500_PRCM
  
  config MFD_STMPE
        bool "STMicroelectronics STMPE"
 -      depends on (I2C=y || SPI_MASTER=y) && GENERIC_HARDIRQS
 +      depends on (I2C=y || SPI_MASTER=y)
        select MFD_CORE
        help
          Support for the STMPE family of I/O Expanders from
@@@ -676,14 -653,14 +676,14 @@@ menu "STMicroelectronics STMPE Interfac
  depends on MFD_STMPE
  
  config STMPE_I2C
-       bool "STMicroelectronics STMPE I2C Inteface"
+       bool "STMicroelectronics STMPE I2C Interface"
        depends on I2C=y
        default y
        help
          This is used to enable I2C interface of STMPE
  
  config STMPE_SPI
-       bool "STMicroelectronics STMPE SPI Inteface"
+       bool "STMicroelectronics STMPE SPI Interface"
        depends on SPI_MASTER
        help
          This is used to enable SPI interface of STMPE
@@@ -691,7 -668,7 +691,7 @@@ endmen
  
  config MFD_STA2X11
        bool "STMicroelectronics STA2X11"
 -      depends on STA2X11 && GENERIC_HARDIRQS
 +      depends on STA2X11
        select MFD_CORE
        select REGMAP_MMIO
  
@@@ -711,6 -688,7 +711,6 @@@ config MFD_TI_AM335X_TSCAD
        select MFD_CORE
        select REGMAP
        select REGMAP_MMIO
 -      depends on GENERIC_HARDIRQS
        help
          If you say yes here you get support for Texas Instruments series
          of Touch Screen /ADC chips.
@@@ -727,7 -705,7 +727,7 @@@ config MFD_DM355EVM_MS
  
  config MFD_LP8788
        bool "TI LP8788 Power Management Unit Driver"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        select IRQ_DOMAIN
@@@ -749,14 -727,14 +749,14 @@@ config MFD_PALMA
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        help
          If you say yes here you get support for the Palmas
          series of PMIC chips from Texas Instruments.
  
  config MFD_TI_SSP
        tristate "TI Sequencer Serial Port support"
 -      depends on ARCH_DAVINCI_TNETV107X && GENERIC_HARDIRQS
 +      depends on ARCH_DAVINCI_TNETV107X
        select MFD_CORE
        ---help---
          Say Y here if you want support for the Sequencer Serial Port
@@@ -771,6 -749,7 +771,6 @@@ config TPS6105
        select REGULATOR
        select MFD_CORE
        select REGULATOR_FIXED_VOLTAGE
 -      depends on GENERIC_HARDIRQS
        help
          This option enables a driver for the TP61050/TPS61052
          high-power "white LED driver". This boost converter is
@@@ -793,7 -772,7 +793,7 @@@ config TPS6501
  config TPS6507X
        tristate "TI TPS6507x Power Management / Touch Screen chips"
        select MFD_CORE
 -      depends on I2C && GENERIC_HARDIRQS
 +      depends on I2C
        help
          If you say yes here you get support for the TPS6507x series of
          Power Management / Touch Screen chips.  These include voltage
@@@ -807,7 -786,7 +807,7 @@@ config TPS65911_COMPARATO
  
  config MFD_TPS65090
        bool "TI TPS65090 Power Management chips"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
  
  config MFD_TPS65217
        tristate "TI TPS65217 Power Management / White LED chips"
 -      depends on I2C && GENERIC_HARDIRQS
 +      depends on I2C
        select MFD_CORE
        select REGMAP_I2C
        help
  
  config MFD_TPS6586X
        bool "TI TPS6586x Power Management chips"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        help
  
  config MFD_TPS65910
        bool "TI TPS65910 Power Management chip"
 -      depends on I2C=y && GPIOLIB && GENERIC_HARDIRQS
 +      depends on I2C=y && GPIOLIB
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
@@@ -871,7 -850,7 +871,7 @@@ config MFD_TPS65912_I2
        bool "TI TPS65912 Power Management chip with I2C"
        select MFD_CORE
        select MFD_TPS65912
 -      depends on I2C=y && GPIOLIB && GENERIC_HARDIRQS
 +      depends on I2C=y && GPIOLIB
        help
          If you say yes here you get support for the TPS65912 series of
          PM chips with I2C interface.
@@@ -880,14 -859,14 +880,14 @@@ config MFD_TPS65912_SP
        bool "TI TPS65912 Power Management chip with SPI"
        select MFD_CORE
        select MFD_TPS65912
 -      depends on SPI_MASTER && GPIOLIB && GENERIC_HARDIRQS
 +      depends on SPI_MASTER && GPIOLIB
        help
          If you say yes here you get support for the TPS65912 series of
          PM chips with SPI interface.
  
  config MFD_TPS80031
        bool "TI TPS80031/TPS80032 Power Management chips"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
  
  config TWL4030_CORE
        bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 Support"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select IRQ_DOMAIN
        select REGMAP_I2C
        help
@@@ -940,13 -919,13 +940,13 @@@ config TWL4030_POWE
  
  config MFD_TWL4030_AUDIO
        bool "TI TWL4030 Audio"
 -      depends on TWL4030_CORE && GENERIC_HARDIRQS
 +      depends on TWL4030_CORE
        select MFD_CORE
        default n
  
  config TWL6040_CORE
        bool "TI TWL6040 audio codec"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
@@@ -970,7 -949,7 +970,7 @@@ config MENELAU
  
  config MFD_WL1273_CORE
        tristate "TI WL1273 FM radio"
 -      depends on I2C && GENERIC_HARDIRQS
 +      depends on I2C
        select MFD_CORE
        default n
        help
@@@ -983,6 -962,7 +983,6 @@@ config MFD_LM353
        depends on I2C
        select MFD_CORE
        select REGMAP_I2C
 -      depends on GENERIC_HARDIRQS
        help
          Say yes here to enable support for National Semiconductor / TI
          LM3533 Lighting Power chips.
@@@ -1004,7 -984,7 +1004,7 @@@ config MFD_TIMBERDAL
  
  config MFD_TC3589X
        bool "Toshiba TC35892 and variants"
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select MFD_CORE
        help
          Support for the Toshiba TC35892 and variants I/O Expander.
@@@ -1019,7 -999,7 +1019,7 @@@ config MFD_TMI
  
  config MFD_T7L66XB
        bool "Toshiba T7L66XB"
 -      depends on ARM && HAVE_CLK && GENERIC_HARDIRQS
 +      depends on ARM && HAVE_CLK
        select MFD_CORE
        select MFD_TMIO
        help
@@@ -1044,7 -1024,7 +1044,7 @@@ config MFD_TC6393X
  
  config MFD_VX855
        tristate "VIA VX855/VX875 integrated south bridge"
 -      depends on PCI && GENERIC_HARDIRQS
 +      depends on PCI
        select MFD_CORE
        help
          Say yes here to enable support for various functions of the
@@@ -1062,7 -1042,7 +1062,7 @@@ config MFD_ARIZONA_I2
        select MFD_ARIZONA
        select MFD_CORE
        select REGMAP_I2C
 -      depends on I2C && GENERIC_HARDIRQS
 +      depends on I2C
        help
          Support for the Wolfson Microelectronics Arizona platform audio SoC
          core functionality controlled via I2C.
@@@ -1072,7 -1052,7 +1072,7 @@@ config MFD_ARIZONA_SP
        select MFD_ARIZONA
        select MFD_CORE
        select REGMAP_SPI
 -      depends on SPI_MASTER && GENERIC_HARDIRQS
 +      depends on SPI_MASTER
        help
          Support for the Wolfson Microelectronics Arizona platform audio SoC
          core functionality controlled via I2C.
@@@ -1090,7 -1070,7 +1090,7 @@@ config MFD_WM511
          Support for Wolfson Microelectronics WM5110 low power audio SoC
  
  config MFD_WM8997
 -      bool "Support Wolfson Microelectronics WM8997"
 +      bool "Wolfson Microelectronics WM8997"
        depends on MFD_ARIZONA
        help
          Support for Wolfson Microelectronics WM8997 low power audio SoC
  config MFD_WM8400
        bool "Wolfson Microelectronics WM8400"
        select MFD_CORE
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        select REGMAP_I2C
        help
          Support for the Wolfson Microelecronics WM8400 PMIC and audio
  
  config MFD_WM831X
        bool
 -      depends on GENERIC_HARDIRQS
  
  config MFD_WM831X_I2C
        bool "Wolfson Microelectronics WM831x/2x PMICs with I2C"
        select MFD_WM831X
        select REGMAP_I2C
        select IRQ_DOMAIN
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        help
          Support for the Wolfson Microelecronics WM831x and WM832x PMICs
          when controlled using I2C.  This driver provides common support
@@@ -1128,7 -1109,7 +1128,7 @@@ config MFD_WM831X_SP
        select MFD_WM831X
        select REGMAP_SPI
        select IRQ_DOMAIN
 -      depends on SPI_MASTER && GENERIC_HARDIRQS
 +      depends on SPI_MASTER
        help
          Support for the Wolfson Microelecronics WM831x and WM832x PMICs
          when controlled using SPI.  This driver provides common support
  
  config MFD_WM8350
        bool
 -      depends on GENERIC_HARDIRQS
  
  config MFD_WM8350_I2C
        bool "Wolfson Microelectronics WM8350 with I2C"
        select MFD_WM8350
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        help
          The WM8350 is an integrated audio and power management
          subsystem with watchdog and RTC functionality for embedded
@@@ -1154,7 -1136,7 +1154,7 @@@ config MFD_WM899
        select MFD_CORE
        select REGMAP_I2C
        select REGMAP_IRQ
 -      depends on I2C=y && GENERIC_HARDIRQS
 +      depends on I2C=y
        help
          The WM8994 is a highly integrated hi-fi CODEC designed for
          smartphone applicatiosn.  As well as audio functionality it
          core support for the WM8994, in order to use the actual
          functionaltiy of the device other drivers must be enabled.
  
 +config MFD_STW481X
 +      bool "Support for ST Microelectronics STw481x"
 +      depends on I2C && ARCH_NOMADIK
 +      select REGMAP_I2C
 +      select MFD_CORE
 +      help
 +        Select this option to enable the STw481x chip driver used
 +        in various ST Microelectronics and ST-Ericsson embedded
 +        Nomadik series.
 +
  endmenu
  endif
  
diff --combined drivers/mtd/nand/docg4.c
index bd1cb672034fe770d2db2b986caa1821c1f63f58,a10491af52aabfbb739fe58a1e06c083b8a85806..1b0265e85a066b2b8903d84645d1df918e4a9ee5
@@@ -44,7 -44,6 +44,7 @@@
  #include <linux/mtd/nand.h>
  #include <linux/bch.h>
  #include <linux/bitrev.h>
 +#include <linux/jiffies.h>
  
  /*
   * In "reliable mode" consecutive 2k pages are used in parallel (in some
@@@ -270,7 -269,7 +270,7 @@@ static int poll_status(struct docg4_pri
         */
  
        uint16_t flash_status;
 -      unsigned int timeo;
 +      unsigned long timeo;
        void __iomem *docptr = doc->virtadr;
  
        dev_dbg(doc->dev, "%s...\n", __func__);
        /* hardware quirk requires reading twice initially */
        flash_status = readw(docptr + DOC_FLASHCONTROL);
  
 -      timeo = 1000;
 +      timeo = jiffies + msecs_to_jiffies(200); /* generous timeout */
        do {
                cpu_relax();
                flash_status = readb(docptr + DOC_FLASHCONTROL);
 -      } while (!(flash_status & DOC_CTRL_FLASHREADY) && --timeo);
 +      } while (!(flash_status & DOC_CTRL_FLASHREADY) &&
 +               time_before(jiffies, timeo));
  
 -
 -      if (!timeo) {
 +      if (unlikely(!(flash_status & DOC_CTRL_FLASHREADY))) {
                dev_err(doc->dev, "%s: timed out!\n", __func__);
                return NAND_STATUS_FAIL;
        }
  
 -      if (unlikely(timeo < 50))
 -              dev_warn(doc->dev, "%s: nearly timed out; %d remaining\n",
 -                       __func__, timeo);
 -
        return 0;
  }
  
@@@ -491,7 -494,7 +491,7 @@@ static uint8_t docg4_read_byte(struct m
                return status;
        }
  
-       dev_warn(doc->dev, "unexpectd call to read_byte()\n");
+       dev_warn(doc->dev, "unexpected call to read_byte()\n");
  
        return 0;
  }
@@@ -1090,6 -1093,7 +1090,6 @@@ static int docg4_block_markbad(struct m
        struct nand_chip *nand = mtd->priv;
        struct docg4_priv *doc = nand->priv;
        struct nand_bbt_descr *bbtd = nand->badblock_pattern;
 -      int block = (int)(ofs >> nand->bbt_erase_shift);
        int page = (int)(ofs >> nand->page_shift);
        uint32_t g4_addr = mtd_to_docg4_address(page, 0);
  
        if (buf == NULL)
                return -ENOMEM;
  
 -      /* update bbt in memory */
 -      nand->bbt[block / 4] |= 0x01 << ((block & 0x03) * 2);
 -
        /* write bit-wise negation of pattern to oob buffer */
        memset(nand->oob_poi, 0xff, mtd->oobsize);
        for (i = 0; i < bbtd->len; i++)
        write_page_prologue(mtd, g4_addr);
        docg4_write_page(mtd, nand, buf, 1);
        ret = pageprog(mtd);
 -      if (!ret)
 -              mtd->ecc_stats.badblocks++;
  
        kfree(buf);
  
@@@ -1236,6 -1245,7 +1236,6 @@@ static void __init init_mtd_structs(str
        nand->block_markbad = docg4_block_markbad;
        nand->read_buf = docg4_read_buf;
        nand->write_buf = docg4_write_buf16;
 -      nand->scan_bbt = nand_default_bbt;
        nand->erase_cmd = docg4_erase_block;
        nand->ecc.read_page = docg4_read_page;
        nand->ecc.write_page = docg4_write_page;
@@@ -1358,6 -1368,7 +1358,6 @@@ static int __init probe_docg4(struct pl
                struct nand_chip *nand = mtd->priv;
                struct docg4_priv *doc = nand->priv;
                nand_release(mtd); /* deletes partitions and mtd devices */
 -              platform_set_drvdata(pdev, NULL);
                free_bch(doc->bch);
                kfree(mtd);
        }
@@@ -1369,6 -1380,7 +1369,6 @@@ static int __exit cleanup_docg4(struct 
  {
        struct docg4_priv *doc = platform_get_drvdata(pdev);
        nand_release(doc->mtd);
 -      platform_set_drvdata(pdev, NULL);
        free_bch(doc->bch);
        kfree(doc->mtd);
        iounmap(doc->virtadr);
index c151e7a6710a4b11d7efaa2816f65b4ba2732e81,8a750ca326d0c623814537affe2c01c868545346..c0463cfca3c477376f0be6767774e73afbc1e3c4
@@@ -652,7 -652,7 +652,7 @@@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev 
                 QUERY_DEV_CAP_RSVD_LKEY_OFFSET);
        MLX4_GET(field, outbox, QUERY_DEV_CAP_FW_REASSIGN_MAC);
        if (field & 1<<6)
 -              dev_cap->flags2 |= MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN;
 +              dev_cap->flags2 |= MLX4_DEV_CAP_FLAG2_REASSIGN_MAC_EN;
        MLX4_GET(dev_cap->max_icm_sz, outbox,
                 QUERY_DEV_CAP_MAX_ICM_SZ_OFFSET);
        if (dev_cap->flags & MLX4_DEV_CAP_FLAG_COUNTERS)
@@@ -1713,6 -1713,7 +1713,6 @@@ void mlx4_opreq_action(struct work_stru
        u32 *outbox;
        u32 modifier;
        u16 token;
 -      u16 type_m;
        u16 type;
        int err;
        u32 num_qps;
                                   MLX4_CMD_GET_OP_REQ, MLX4_CMD_TIME_CLASS_A,
                                   MLX4_CMD_NATIVE);
                if (err) {
-                       mlx4_err(dev, "Failed to retreive required operation: %d\n",
+                       mlx4_err(dev, "Failed to retrieve required operation: %d\n",
                                 err);
                        return;
                }
                MLX4_GET(modifier, outbox, GET_OP_REQ_MODIFIER_OFFSET);
                MLX4_GET(token, outbox, GET_OP_REQ_TOKEN_OFFSET);
                MLX4_GET(type, outbox, GET_OP_REQ_TYPE_OFFSET);
 -              type_m = type >> 12;
                type &= 0xfff;
  
                switch (type) {
index a126bdf2795248a1fdb888a18aef1ce3b85f80db,e8c56af97dfe98c9fbd5e1923b10b16c02c00aec..7e84b984dba16c6951eacd0fed81e3402cc0310f
@@@ -902,7 -902,7 +902,7 @@@ void __qlcnic_83xx_process_aen(struct q
                         QLCNIC_MBX_RSP(event[0]));
                break;
        case QLCNIC_MBX_DCBX_CONFIG_CHANGE_EVENT:
 -              qlcnic_dcb_handle_aen(adapter, (void *)&event[1]);
 +              qlcnic_dcb_aen_handler(adapter->dcb, (void *)&event[1]);
                break;
        default:
                dev_dbg(&adapter->pdev->dev, "Unsupported AEN:0x%x.\n",
@@@ -1722,7 -1722,7 +1722,7 @@@ static void qlcnic_extend_lb_idc_cmpltn
        struct qlcnic_hardware_context *ahw = adapter->ahw;
        int temp;
  
-       netdev_info(adapter->netdev, "Recieved loopback IDC time extend event for 0x%x seconds\n",
+       netdev_info(adapter->netdev, "Received loopback IDC time extend event for 0x%x seconds\n",
                    ahw->extend_lb_time);
        temp = ahw->extend_lb_time * 1000;
        *max_wait_count += temp / QLC_83XX_LB_MSLEEP_COUNT;
@@@ -2321,7 -2321,19 +2321,7 @@@ int qlcnic_83xx_get_pci_info(struct qlc
                        i++;
                        memcpy(pci_info->mac + sizeof(u32), &cmd.rsp.arg[i], 2);
                        i = i + 3;
 -                      if (ahw->op_mode == QLCNIC_MGMT_FUNC)
 -                              dev_info(dev, "id = %d active = %d type = %d\n"
 -                                       "\tport = %d min bw = %d max bw = %d\n"
 -                                       "\tmac_addr =  %pM\n", pci_info->id,
 -                                       pci_info->active, pci_info->type,
 -                                       pci_info->default_port,
 -                                       pci_info->tx_min_bw,
 -                                       pci_info->tx_max_bw, pci_info->mac);
                }
 -              if (ahw->op_mode == QLCNIC_MGMT_FUNC)
 -                      dev_info(dev, "Max functions = %d, active functions = %d\n",
 -                               ahw->max_pci_func, ahw->act_pci_func);
 -
        } else {
                dev_err(dev, "Failed to get PCI Info, error = %d\n", err);
                err = -EIO;
@@@ -3267,12 -3279,12 +3267,12 @@@ int qlcnic_83xx_reg_test(struct qlcnic_
        return 0;
  }
  
 -int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *adapter)
 +inline int qlcnic_83xx_get_regs_len(struct qlcnic_adapter *adapter)
  {
        return (ARRAY_SIZE(qlcnic_83xx_ext_reg_tbl) *
 -              sizeof(adapter->ahw->ext_reg_tbl)) +
 -              (ARRAY_SIZE(qlcnic_83xx_reg_tbl) +
 -              sizeof(adapter->ahw->reg_tbl));
 +              sizeof(*adapter->ahw->ext_reg_tbl)) +
 +              (ARRAY_SIZE(qlcnic_83xx_reg_tbl) *
 +              sizeof(*adapter->ahw->reg_tbl));
  }
  
  int qlcnic_83xx_get_registers(struct qlcnic_adapter *adapter, u32 *regs_buff)
@@@ -3369,21 -3381,10 +3369,21 @@@ void qlcnic_83xx_get_pauseparam(struct 
        }
        config = ahw->port_config;
        if (config & QLC_83XX_CFG_STD_PAUSE) {
 -              if (config & QLC_83XX_CFG_STD_TX_PAUSE)
 +              switch (MSW(config)) {
 +              case QLC_83XX_TX_PAUSE:
                        pause->tx_pause = 1;
 -              if (config & QLC_83XX_CFG_STD_RX_PAUSE)
 +                      break;
 +              case QLC_83XX_RX_PAUSE:
                        pause->rx_pause = 1;
 +                      break;
 +              case QLC_83XX_TX_RX_PAUSE:
 +              default:
 +                      /* Backward compatibility for existing
 +                       * flash definitions
 +                       */
 +                      pause->tx_pause = 1;
 +                      pause->rx_pause = 1;
 +              }
        }
  
        if (QLC_83XX_AUTONEG(config))
@@@ -3426,8 -3427,7 +3426,8 @@@ int qlcnic_83xx_set_pauseparam(struct q
                ahw->port_config &= ~QLC_83XX_CFG_STD_RX_PAUSE;
                ahw->port_config |= QLC_83XX_CFG_STD_TX_PAUSE;
        } else if (!pause->rx_pause && !pause->tx_pause) {
 -              ahw->port_config &= ~QLC_83XX_CFG_STD_TX_RX_PAUSE;
 +              ahw->port_config &= ~(QLC_83XX_CFG_STD_TX_RX_PAUSE |
 +                                    QLC_83XX_CFG_STD_PAUSE);
        }
        status = qlcnic_83xx_set_port_config(adapter);
        if (status) {
index f8d59c7b90821a69b3401a7ec143bd6d8e0fc367,d510bffa0a6ad09d5c847a5b4f9032056047f5ea..9e86a811086f6bf2e8316afdecdd29a4ec5195c9
@@@ -36,9 -36,11 +36,9 @@@ static unsigned int ath10k_target_ps
  module_param(ath10k_target_ps, uint, 0644);
  MODULE_PARM_DESC(ath10k_target_ps, "Enable ath10k Target (SoC) PS option");
  
 -#define QCA988X_1_0_DEVICE_ID (0xabcd)
  #define QCA988X_2_0_DEVICE_ID (0x003c)
  
  static DEFINE_PCI_DEVICE_TABLE(ath10k_pci_id_table) = {
 -      { PCI_VDEVICE(ATHEROS, QCA988X_1_0_DEVICE_ID) }, /* PCI-E QCA988X V1 */
        { PCI_VDEVICE(ATHEROS, QCA988X_2_0_DEVICE_ID) }, /* PCI-E QCA988X V2 */
        {0}
  };
@@@ -48,9 -50,9 +48,9 @@@ static int ath10k_pci_diag_read_access(
  
  static void ath10k_pci_process_ce(struct ath10k *ar);
  static int ath10k_pci_post_rx(struct ath10k *ar);
 -static int ath10k_pci_post_rx_pipe(struct hif_ce_pipe_info *pipe_info,
 +static int ath10k_pci_post_rx_pipe(struct ath10k_pci_pipe *pipe_info,
                                             int num);
 -static void ath10k_pci_rx_pipe_cleanup(struct hif_ce_pipe_info *pipe_info);
 +static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info);
  static void ath10k_pci_stop_ce(struct ath10k *ar);
  static void ath10k_pci_device_reset(struct ath10k *ar);
  static int ath10k_pci_reset_target(struct ath10k *ar);
@@@ -58,145 -60,43 +58,145 @@@ static int ath10k_pci_start_intr(struc
  static void ath10k_pci_stop_intr(struct ath10k *ar);
  
  static const struct ce_attr host_ce_config_wlan[] = {
 -      /* host->target HTC control and raw streams */
 -      { /* CE0 */ CE_ATTR_FLAGS, 0, 16, 256, 0, NULL,},
 -      /* could be moved to share CE3 */
 -      /* target->host HTT + HTC control */
 -      { /* CE1 */ CE_ATTR_FLAGS, 0, 0, 512, 512, NULL,},
 -      /* target->host WMI */
 -      { /* CE2 */ CE_ATTR_FLAGS, 0, 0, 2048, 32, NULL,},
 -      /* host->target WMI */
 -      { /* CE3 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL,},
 -      /* host->target HTT */
 -      { /* CE4 */ CE_ATTR_FLAGS | CE_ATTR_DIS_INTR, 0,
 -                  CE_HTT_H2T_MSG_SRC_NENTRIES, 256, 0, NULL,},
 -      /* unused */
 -      { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
 -      /* Target autonomous hif_memcpy */
 -      { /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
 -      /* ce_diag, the Diagnostic Window */
 -      { /* CE7 */ CE_ATTR_FLAGS, 0, 2, DIAG_TRANSFER_LIMIT, 2, NULL,},
 +      /* CE0: host->target HTC control and raw streams */
 +      {
 +              .flags = CE_ATTR_FLAGS,
 +              .src_nentries = 16,
 +              .src_sz_max = 256,
 +              .dest_nentries = 0,
 +      },
 +
 +      /* CE1: target->host HTT + HTC control */
 +      {
 +              .flags = CE_ATTR_FLAGS,
 +              .src_nentries = 0,
 +              .src_sz_max = 512,
 +              .dest_nentries = 512,
 +      },
 +
 +      /* CE2: target->host WMI */
 +      {
 +              .flags = CE_ATTR_FLAGS,
 +              .src_nentries = 0,
 +              .src_sz_max = 2048,
 +              .dest_nentries = 32,
 +      },
 +
 +      /* CE3: host->target WMI */
 +      {
 +              .flags = CE_ATTR_FLAGS,
 +              .src_nentries = 32,
 +              .src_sz_max = 2048,
 +              .dest_nentries = 0,
 +      },
 +
 +      /* CE4: host->target HTT */
 +      {
 +              .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
 +              .src_nentries = CE_HTT_H2T_MSG_SRC_NENTRIES,
 +              .src_sz_max = 256,
 +              .dest_nentries = 0,
 +      },
 +
 +      /* CE5: unused */
 +      {
 +              .flags = CE_ATTR_FLAGS,
 +              .src_nentries = 0,
 +              .src_sz_max = 0,
 +              .dest_nentries = 0,
 +      },
 +
 +      /* CE6: target autonomous hif_memcpy */
 +      {
 +              .flags = CE_ATTR_FLAGS,
 +              .src_nentries = 0,
 +              .src_sz_max = 0,
 +              .dest_nentries = 0,
 +      },
 +
 +      /* CE7: ce_diag, the Diagnostic Window */
 +      {
 +              .flags = CE_ATTR_FLAGS,
 +              .src_nentries = 2,
 +              .src_sz_max = DIAG_TRANSFER_LIMIT,
 +              .dest_nentries = 2,
 +      },
  };
  
  /* Target firmware's Copy Engine configuration. */
  static const struct ce_pipe_config target_ce_config_wlan[] = {
 -      /* host->target HTC control and raw streams */
 -      { /* CE0 */ 0, PIPEDIR_OUT, 32, 256, CE_ATTR_FLAGS, 0,},
 -      /* target->host HTT + HTC control */
 -      { /* CE1 */ 1, PIPEDIR_IN, 32, 512, CE_ATTR_FLAGS, 0,},
 -      /* target->host WMI */
 -      { /* CE2 */ 2, PIPEDIR_IN, 32, 2048, CE_ATTR_FLAGS, 0,},
 -      /* host->target WMI */
 -      { /* CE3 */ 3, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0,},
 -      /* host->target HTT */
 -      { /* CE4 */ 4, PIPEDIR_OUT, 256, 256, CE_ATTR_FLAGS, 0,},
 +      /* CE0: host->target HTC control and raw streams */
 +      {
 +              .pipenum = 0,
 +              .pipedir = PIPEDIR_OUT,
 +              .nentries = 32,
 +              .nbytes_max = 256,
 +              .flags = CE_ATTR_FLAGS,
 +              .reserved = 0,
 +      },
 +
 +      /* CE1: target->host HTT + HTC control */
 +      {
 +              .pipenum = 1,
 +              .pipedir = PIPEDIR_IN,
 +              .nentries = 32,
 +              .nbytes_max = 512,
 +              .flags = CE_ATTR_FLAGS,
 +              .reserved = 0,
 +      },
 +
 +      /* CE2: target->host WMI */
 +      {
 +              .pipenum = 2,
 +              .pipedir = PIPEDIR_IN,
 +              .nentries = 32,
 +              .nbytes_max = 2048,
 +              .flags = CE_ATTR_FLAGS,
 +              .reserved = 0,
 +      },
 +
 +      /* CE3: host->target WMI */
 +      {
 +              .pipenum = 3,
 +              .pipedir = PIPEDIR_OUT,
 +              .nentries = 32,
 +              .nbytes_max = 2048,
 +              .flags = CE_ATTR_FLAGS,
 +              .reserved = 0,
 +      },
 +
 +      /* CE4: host->target HTT */
 +      {
 +              .pipenum = 4,
 +              .pipedir = PIPEDIR_OUT,
 +              .nentries = 256,
 +              .nbytes_max = 256,
 +              .flags = CE_ATTR_FLAGS,
 +              .reserved = 0,
 +      },
 +
        /* NB: 50% of src nentries, since tx has 2 frags */
 -      /* unused */
 -      { /* CE5 */ 5, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0,},
 -      /* Reserved for target autonomous hif_memcpy */
 -      { /* CE6 */ 6, PIPEDIR_INOUT, 32, 4096, CE_ATTR_FLAGS, 0,},
 +
 +      /* CE5: unused */
 +      {
 +              .pipenum = 5,
 +              .pipedir = PIPEDIR_OUT,
 +              .nentries = 32,
 +              .nbytes_max = 2048,
 +              .flags = CE_ATTR_FLAGS,
 +              .reserved = 0,
 +      },
 +
 +      /* CE6: Reserved for target autonomous hif_memcpy */
 +      {
 +              .pipenum = 6,
 +              .pipedir = PIPEDIR_INOUT,
 +              .nentries = 32,
 +              .nbytes_max = 4096,
 +              .flags = CE_ATTR_FLAGS,
 +              .reserved = 0,
 +      },
 +
        /* CE7 used only by Host */
  };
  
@@@ -214,7 -114,7 +214,7 @@@ static int ath10k_pci_diag_read_mem(str
        unsigned int completed_nbytes, orig_nbytes, remaining_bytes;
        unsigned int id;
        unsigned int flags;
 -      struct ce_state *ce_diag;
 +      struct ath10k_ce_pipe *ce_diag;
        /* Host buffer address in CE space */
        u32 ce_data;
        dma_addr_t ce_data_base = 0;
@@@ -378,7 -278,7 +378,7 @@@ static int ath10k_pci_diag_write_mem(st
        unsigned int completed_nbytes, orig_nbytes, remaining_bytes;
        unsigned int id;
        unsigned int flags;
 -      struct ce_state *ce_diag;
 +      struct ath10k_ce_pipe *ce_diag;
        void *data_buf = NULL;
        u32 ce_data;    /* Host buffer address in CE space */
        dma_addr_t ce_data_base = 0;
@@@ -537,7 -437,7 +537,7 @@@ static void ath10k_pci_wait(struct ath1
                ath10k_warn("Unable to wakeup target\n");
  }
  
 -void ath10k_do_pci_wake(struct ath10k *ar)
 +int ath10k_do_pci_wake(struct ath10k *ar)
  {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
        void __iomem *pci_addr = ar_pci->mem;
        atomic_inc(&ar_pci->keep_awake_count);
  
        if (ar_pci->verified_awake)
 -              return;
 +              return 0;
  
        for (;;) {
                if (ath10k_pci_target_is_awake(ar)) {
                        ar_pci->verified_awake = true;
 -                      break;
 +                      return 0;
                }
  
                if (tot_delay > PCIE_WAKE_TIMEOUT) {
 -                      ath10k_warn("target takes too long to wake up (awake count %d)\n",
 +                      ath10k_warn("target took longer %d us to wake up (awake count %d)\n",
 +                                  PCIE_WAKE_TIMEOUT,
                                    atomic_read(&ar_pci->keep_awake_count));
 -                      break;
 +                      return -ETIMEDOUT;
                }
  
                udelay(curr_delay);
@@@ -594,7 -493,7 +594,7 @@@ void ath10k_do_pci_sleep(struct ath10k 
   * FIXME: Handle OOM properly.
   */
  static inline
 -struct ath10k_pci_compl *get_free_compl(struct hif_ce_pipe_info *pipe_info)
 +struct ath10k_pci_compl *get_free_compl(struct ath10k_pci_pipe *pipe_info)
  {
        struct ath10k_pci_compl *compl = NULL;
  
@@@ -612,28 -511,39 +612,28 @@@ exit
  }
  
  /* Called by lower (CE) layer when a send to Target completes. */
 -static void ath10k_pci_ce_send_done(struct ce_state *ce_state,
 -                                  void *transfer_context,
 -                                  u32 ce_data,
 -                                  unsigned int nbytes,
 -                                  unsigned int transfer_id)
 +static void ath10k_pci_ce_send_done(struct ath10k_ce_pipe *ce_state)
  {
        struct ath10k *ar = ce_state->ar;
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct hif_ce_pipe_info *pipe_info =  &ar_pci->pipe_info[ce_state->id];
 +      struct ath10k_pci_pipe *pipe_info =  &ar_pci->pipe_info[ce_state->id];
        struct ath10k_pci_compl *compl;
 -      bool process = false;
 -
 -      do {
 -              /*
 -               * For the send completion of an item in sendlist, just
 -               * increment num_sends_allowed. The upper layer callback will
 -               * be triggered when last fragment is done with send.
 -               */
 -              if (transfer_context == CE_SENDLIST_ITEM_CTXT) {
 -                      spin_lock_bh(&pipe_info->pipe_lock);
 -                      pipe_info->num_sends_allowed++;
 -                      spin_unlock_bh(&pipe_info->pipe_lock);
 -                      continue;
 -              }
 +      void *transfer_context;
 +      u32 ce_data;
 +      unsigned int nbytes;
 +      unsigned int transfer_id;
  
 +      while (ath10k_ce_completed_send_next(ce_state, &transfer_context,
 +                                           &ce_data, &nbytes,
 +                                           &transfer_id) == 0) {
                compl = get_free_compl(pipe_info);
                if (!compl)
                        break;
  
 -              compl->send_or_recv = HIF_CE_COMPLETE_SEND;
 +              compl->state = ATH10K_PCI_COMPL_SEND;
                compl->ce_state = ce_state;
                compl->pipe_info = pipe_info;
 -              compl->transfer_context = transfer_context;
 +              compl->skb = transfer_context;
                compl->nbytes = nbytes;
                compl->transfer_id = transfer_id;
                compl->flags = 0;
                spin_lock_bh(&ar_pci->compl_lock);
                list_add_tail(&compl->list, &ar_pci->compl_process);
                spin_unlock_bh(&ar_pci->compl_lock);
 -
 -              process = true;
 -      } while (ath10k_ce_completed_send_next(ce_state,
 -                                                         &transfer_context,
 -                                                         &ce_data, &nbytes,
 -                                                         &transfer_id) == 0);
 -
 -      /*
 -       * If only some of the items within a sendlist have completed,
 -       * don't invoke completion processing until the entire sendlist
 -       * has been sent.
 -       */
 -      if (!process)
 -              return;
 +      }
  
        ath10k_pci_process_ce(ar);
  }
  
  /* Called by lower (CE) layer when data is received from the Target. */
 -static void ath10k_pci_ce_recv_data(struct ce_state *ce_state,
 -                                  void *transfer_context, u32 ce_data,
 -                                  unsigned int nbytes,
 -                                  unsigned int transfer_id,
 -                                  unsigned int flags)
 +static void ath10k_pci_ce_recv_data(struct ath10k_ce_pipe *ce_state)
  {
        struct ath10k *ar = ce_state->ar;
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct hif_ce_pipe_info *pipe_info =  &ar_pci->pipe_info[ce_state->id];
 +      struct ath10k_pci_pipe *pipe_info =  &ar_pci->pipe_info[ce_state->id];
        struct ath10k_pci_compl *compl;
        struct sk_buff *skb;
 +      void *transfer_context;
 +      u32 ce_data;
 +      unsigned int nbytes;
 +      unsigned int transfer_id;
 +      unsigned int flags;
  
 -      do {
 +      while (ath10k_ce_completed_recv_next(ce_state, &transfer_context,
 +                                           &ce_data, &nbytes, &transfer_id,
 +                                           &flags) == 0) {
                compl = get_free_compl(pipe_info);
                if (!compl)
                        break;
  
 -              compl->send_or_recv = HIF_CE_COMPLETE_RECV;
 +              compl->state = ATH10K_PCI_COMPL_RECV;
                compl->ce_state = ce_state;
                compl->pipe_info = pipe_info;
 -              compl->transfer_context = transfer_context;
 +              compl->skb = transfer_context;
                compl->nbytes = nbytes;
                compl->transfer_id = transfer_id;
                compl->flags = flags;
                spin_lock_bh(&ar_pci->compl_lock);
                list_add_tail(&compl->list, &ar_pci->compl_process);
                spin_unlock_bh(&ar_pci->compl_lock);
 -
 -      } while (ath10k_ce_completed_recv_next(ce_state,
 -                                                         &transfer_context,
 -                                                         &ce_data, &nbytes,
 -                                                         &transfer_id,
 -                                                         &flags) == 0);
 +      }
  
        ath10k_pci_process_ce(ar);
  }
@@@ -700,12 -625,15 +700,12 @@@ static int ath10k_pci_hif_send_head(str
  {
        struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(nbuf);
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct hif_ce_pipe_info *pipe_info = &(ar_pci->pipe_info[pipe_id]);
 -      struct ce_state *ce_hdl = pipe_info->ce_hdl;
 -      struct ce_sendlist sendlist;
 +      struct ath10k_pci_pipe *pipe_info = &(ar_pci->pipe_info[pipe_id]);
 +      struct ath10k_ce_pipe *ce_hdl = pipe_info->ce_hdl;
        unsigned int len;
        u32 flags = 0;
        int ret;
  
 -      memset(&sendlist, 0, sizeof(struct ce_sendlist));
 -
        len = min(bytes, nbuf->len);
        bytes -= len;
  
                        "ath10k tx: data: ",
                        nbuf->data, nbuf->len);
  
 -      ath10k_ce_sendlist_buf_add(&sendlist, skb_cb->paddr, len, flags);
 -
 -      /* Make sure we have resources to handle this request */
 -      spin_lock_bh(&pipe_info->pipe_lock);
 -      if (!pipe_info->num_sends_allowed) {
 -              ath10k_warn("Pipe: %d is full\n", pipe_id);
 -              spin_unlock_bh(&pipe_info->pipe_lock);
 -              return -ENOSR;
 -      }
 -      pipe_info->num_sends_allowed--;
 -      spin_unlock_bh(&pipe_info->pipe_lock);
 -
 -      ret = ath10k_ce_sendlist_send(ce_hdl, nbuf, &sendlist, transfer_id);
 +      ret = ath10k_ce_send(ce_hdl, nbuf, skb_cb->paddr, len, transfer_id,
 +                           flags);
        if (ret)
                ath10k_warn("CE send failed: %p\n", nbuf);
  
  static u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe)
  {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct hif_ce_pipe_info *pipe_info = &(ar_pci->pipe_info[pipe]);
 -      int ret;
 -
 -      spin_lock_bh(&pipe_info->pipe_lock);
 -      ret = pipe_info->num_sends_allowed;
 -      spin_unlock_bh(&pipe_info->pipe_lock);
 -
 -      return ret;
 +      return ath10k_ce_num_free_src_entries(ar_pci->pipe_info[pipe].ce_hdl);
  }
  
  static void ath10k_pci_hif_dump_area(struct ath10k *ar)
@@@ -818,9 -764,9 +818,9 @@@ static void ath10k_pci_hif_set_callback
  static int ath10k_pci_start_ce(struct ath10k *ar)
  {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct ce_state *ce_diag = ar_pci->ce_diag;
 +      struct ath10k_ce_pipe *ce_diag = ar_pci->ce_diag;
        const struct ce_attr *attr;
 -      struct hif_ce_pipe_info *pipe_info;
 +      struct ath10k_pci_pipe *pipe_info;
        struct ath10k_pci_compl *compl;
        int i, pipe_num, completions, disable_interrupts;
  
                                                   ath10k_pci_ce_send_done,
                                                   disable_interrupts);
                        completions += attr->src_nentries;
 -                      pipe_info->num_sends_allowed = attr->src_nentries - 1;
                }
  
                if (attr->dest_nentries) {
                        continue;
  
                for (i = 0; i < completions; i++) {
 -                      compl = kmalloc(sizeof(struct ath10k_pci_compl),
 -                                      GFP_KERNEL);
 +                      compl = kmalloc(sizeof(*compl), GFP_KERNEL);
                        if (!compl) {
                                ath10k_warn("No memory for completion state\n");
                                ath10k_pci_stop_ce(ar);
                                return -ENOMEM;
                        }
  
 -                      compl->send_or_recv = HIF_CE_COMPLETE_FREE;
 +                      compl->state = ATH10K_PCI_COMPL_FREE;
                        list_add_tail(&compl->list, &pipe_info->compl_free);
                }
        }
@@@ -892,7 -840,7 +892,7 @@@ static void ath10k_pci_stop_ce(struct a
         * their associated resources */
        spin_lock_bh(&ar_pci->compl_lock);
        list_for_each_entry(compl, &ar_pci->compl_process, list) {
 -              skb = (struct sk_buff *)compl->transfer_context;
 +              skb = compl->skb;
                ATH10K_SKB_CB(skb)->is_aborted = true;
        }
        spin_unlock_bh(&ar_pci->compl_lock);
@@@ -902,7 -850,7 +902,7 @@@ static void ath10k_pci_cleanup_ce(struc
  {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
        struct ath10k_pci_compl *compl, *tmp;
 -      struct hif_ce_pipe_info *pipe_info;
 +      struct ath10k_pci_pipe *pipe_info;
        struct sk_buff *netbuf;
        int pipe_num;
  
  
        list_for_each_entry_safe(compl, tmp, &ar_pci->compl_process, list) {
                list_del(&compl->list);
 -              netbuf = (struct sk_buff *)compl->transfer_context;
 +              netbuf = compl->skb;
                dev_kfree_skb_any(netbuf);
                kfree(compl);
        }
@@@ -964,14 -912,12 +964,14 @@@ static void ath10k_pci_process_ce(struc
                list_del(&compl->list);
                spin_unlock_bh(&ar_pci->compl_lock);
  
 -              if (compl->send_or_recv == HIF_CE_COMPLETE_SEND) {
 +              switch (compl->state) {
 +              case ATH10K_PCI_COMPL_SEND:
                        cb->tx_completion(ar,
 -                                        compl->transfer_context,
 +                                        compl->skb,
                                          compl->transfer_id);
                        send_done = 1;
 -              } else {
 +                      break;
 +              case ATH10K_PCI_COMPL_RECV:
                        ret = ath10k_pci_post_rx_pipe(compl->pipe_info, 1);
                        if (ret) {
                                ath10k_warn("Unable to post recv buffer for pipe: %d\n",
                                break;
                        }
  
 -                      skb = (struct sk_buff *)compl->transfer_context;
 +                      skb = compl->skb;
                        nbytes = compl->nbytes;
  
                        ath10k_dbg(ATH10K_DBG_PCI,
                                            nbytes,
                                            skb->len + skb_tailroom(skb));
                        }
 +                      break;
 +              case ATH10K_PCI_COMPL_FREE:
 +                      ath10k_warn("free completion cannot be processed\n");
 +                      break;
 +              default:
 +                      ath10k_warn("invalid completion state (%d)\n",
 +                                  compl->state);
 +                      break;
                }
  
 -              compl->send_or_recv = HIF_CE_COMPLETE_FREE;
 +              compl->state = ATH10K_PCI_COMPL_FREE;
  
                /*
                 * Add completion back to the pipe's free list.
                 */
                spin_lock_bh(&compl->pipe_info->pipe_lock);
                list_add_tail(&compl->list, &compl->pipe_info->compl_free);
 -              compl->pipe_info->num_sends_allowed += send_done;
                spin_unlock_bh(&compl->pipe_info->pipe_lock);
        }
  
@@@ -1098,12 -1037,12 +1098,12 @@@ static void ath10k_pci_hif_get_default_
                                                 &dl_is_polled);
  }
  
 -static int ath10k_pci_post_rx_pipe(struct hif_ce_pipe_info *pipe_info,
 +static int ath10k_pci_post_rx_pipe(struct ath10k_pci_pipe *pipe_info,
                                   int num)
  {
        struct ath10k *ar = pipe_info->hif_ce_state;
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct ce_state *ce_state = pipe_info->ce_hdl;
 +      struct ath10k_ce_pipe *ce_state = pipe_info->ce_hdl;
        struct sk_buff *skb;
        dma_addr_t ce_data;
        int i, ret = 0;
@@@ -1158,7 -1097,7 +1158,7 @@@ err
  static int ath10k_pci_post_rx(struct ath10k *ar)
  {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct hif_ce_pipe_info *pipe_info;
 +      struct ath10k_pci_pipe *pipe_info;
        const struct ce_attr *attr;
        int pipe_num, ret = 0;
  
@@@ -1208,11 -1147,11 +1208,11 @@@ static int ath10k_pci_hif_start(struct 
        return 0;
  }
  
 -static void ath10k_pci_rx_pipe_cleanup(struct hif_ce_pipe_info *pipe_info)
 +static void ath10k_pci_rx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info)
  {
        struct ath10k *ar;
        struct ath10k_pci *ar_pci;
 -      struct ce_state *ce_hdl;
 +      struct ath10k_ce_pipe *ce_hdl;
        u32 buf_sz;
        struct sk_buff *netbuf;
        u32 ce_data;
        }
  }
  
 -static void ath10k_pci_tx_pipe_cleanup(struct hif_ce_pipe_info *pipe_info)
 +static void ath10k_pci_tx_pipe_cleanup(struct ath10k_pci_pipe *pipe_info)
  {
        struct ath10k *ar;
        struct ath10k_pci *ar_pci;
 -      struct ce_state *ce_hdl;
 +      struct ath10k_ce_pipe *ce_hdl;
        struct sk_buff *netbuf;
        u32 ce_data;
        unsigned int nbytes;
  
        while (ath10k_ce_cancel_send_next(ce_hdl, (void **)&netbuf,
                                          &ce_data, &nbytes, &id) == 0) {
 -              if (netbuf != CE_SENDLIST_ITEM_CTXT)
 -                      /*
 -                       * Indicate the completion to higer layer to free
 -                       * the buffer
 -                       */
 -                      ATH10K_SKB_CB(netbuf)->is_aborted = true;
 -                      ar_pci->msg_callbacks_current.tx_completion(ar,
 -                                                                  netbuf,
 -                                                                  id);
 +              /*
 +               * Indicate the completion to higer layer to free
 +               * the buffer
 +               */
 +              ATH10K_SKB_CB(netbuf)->is_aborted = true;
 +              ar_pci->msg_callbacks_current.tx_completion(ar,
 +                                                          netbuf,
 +                                                          id);
        }
  }
  
@@@ -1292,7 -1232,7 +1292,7 @@@ static void ath10k_pci_buffer_cleanup(s
        int pipe_num;
  
        for (pipe_num = 0; pipe_num < ar_pci->ce_count; pipe_num++) {
 -              struct hif_ce_pipe_info *pipe_info;
 +              struct ath10k_pci_pipe *pipe_info;
  
                pipe_info = &ar_pci->pipe_info[pipe_num];
                ath10k_pci_rx_pipe_cleanup(pipe_info);
  static void ath10k_pci_ce_deinit(struct ath10k *ar)
  {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct hif_ce_pipe_info *pipe_info;
 +      struct ath10k_pci_pipe *pipe_info;
        int pipe_num;
  
        for (pipe_num = 0; pipe_num < ar_pci->ce_count; pipe_num++) {
@@@ -1353,10 -1293,8 +1353,10 @@@ static int ath10k_pci_hif_exchange_bmi_
                                           void *resp, u32 *resp_len)
  {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct ce_state *ce_tx = ar_pci->pipe_info[BMI_CE_NUM_TO_TARG].ce_hdl;
 -      struct ce_state *ce_rx = ar_pci->pipe_info[BMI_CE_NUM_TO_HOST].ce_hdl;
 +      struct ath10k_pci_pipe *pci_tx = &ar_pci->pipe_info[BMI_CE_NUM_TO_TARG];
 +      struct ath10k_pci_pipe *pci_rx = &ar_pci->pipe_info[BMI_CE_NUM_TO_HOST];
 +      struct ath10k_ce_pipe *ce_tx = pci_tx->ce_hdl;
 +      struct ath10k_ce_pipe *ce_rx = pci_rx->ce_hdl;
        dma_addr_t req_paddr = 0;
        dma_addr_t resp_paddr = 0;
        struct bmi_xfer xfer = {};
@@@ -1440,16 -1378,13 +1440,16 @@@ err_dma
        return ret;
  }
  
 -static void ath10k_pci_bmi_send_done(struct ce_state *ce_state,
 -                                   void *transfer_context,
 -                                   u32 data,
 -                                   unsigned int nbytes,
 -                                   unsigned int transfer_id)
 +static void ath10k_pci_bmi_send_done(struct ath10k_ce_pipe *ce_state)
  {
 -      struct bmi_xfer *xfer = transfer_context;
 +      struct bmi_xfer *xfer;
 +      u32 ce_data;
 +      unsigned int nbytes;
 +      unsigned int transfer_id;
 +
 +      if (ath10k_ce_completed_send_next(ce_state, (void **)&xfer, &ce_data,
 +                                        &nbytes, &transfer_id))
 +              return;
  
        if (xfer->wait_for_resp)
                return;
        complete(&xfer->done);
  }
  
 -static void ath10k_pci_bmi_recv_data(struct ce_state *ce_state,
 -                                   void *transfer_context,
 -                                   u32 data,
 -                                   unsigned int nbytes,
 -                                   unsigned int transfer_id,
 -                                   unsigned int flags)
 +static void ath10k_pci_bmi_recv_data(struct ath10k_ce_pipe *ce_state)
  {
 -      struct bmi_xfer *xfer = transfer_context;
 +      struct bmi_xfer *xfer;
 +      u32 ce_data;
 +      unsigned int nbytes;
 +      unsigned int transfer_id;
 +      unsigned int flags;
 +
 +      if (ath10k_ce_completed_recv_next(ce_state, (void **)&xfer, &ce_data,
 +                                        &nbytes, &transfer_id, &flags))
 +              return;
  
        if (!xfer->wait_for_resp) {
                ath10k_warn("unexpected: BMI data received; ignoring\n");
@@@ -1747,7 -1679,7 +1747,7 @@@ static int ath10k_pci_init_config(struc
  static int ath10k_pci_ce_init(struct ath10k *ar)
  {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      struct hif_ce_pipe_info *pipe_info;
 +      struct ath10k_pci_pipe *pipe_info;
        const struct ce_attr *attr;
        int pipe_num;
  
@@@ -1963,7 -1895,7 +1963,7 @@@ static const struct ath10k_hif_ops ath1
  
  static void ath10k_pci_ce_tasklet(unsigned long ptr)
  {
 -      struct hif_ce_pipe_info *pipe = (struct hif_ce_pipe_info *)ptr;
 +      struct ath10k_pci_pipe *pipe = (struct ath10k_pci_pipe *)ptr;
        struct ath10k_pci *ar_pci = pipe->ar_pci;
  
        ath10k_ce_per_engine_service(ar_pci->ar, pipe->pipe_num);
@@@ -2280,13 -2212,18 +2280,13 @@@ static int ath10k_pci_reset_target(stru
  
  static void ath10k_pci_device_reset(struct ath10k *ar)
  {
 -      struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
 -      void __iomem *mem = ar_pci->mem;
        int i;
        u32 val;
  
        if (!SOC_GLOBAL_RESET_ADDRESS)
                return;
  
 -      if (!mem)
 -              return;
 -
 -      ath10k_pci_reg_write32(mem, PCIE_SOC_WAKE_ADDRESS,
 +      ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS,
                               PCIE_SOC_WAKE_V_MASK);
        for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
                if (ath10k_pci_target_is_awake(ar))
        }
  
        /* Put Target, including PCIe, into RESET. */
 -      val = ath10k_pci_reg_read32(mem, SOC_GLOBAL_RESET_ADDRESS);
 +      val = ath10k_pci_reg_read32(ar, SOC_GLOBAL_RESET_ADDRESS);
        val |= 1;
 -      ath10k_pci_reg_write32(mem, SOC_GLOBAL_RESET_ADDRESS, val);
 +      ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  
        for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
 -              if (ath10k_pci_reg_read32(mem, RTC_STATE_ADDRESS) &
 +              if (ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
                                          RTC_STATE_COLD_RESET_MASK)
                        break;
                msleep(1);
  
        /* Pull Target, including PCIe, out of RESET. */
        val &= ~1;
 -      ath10k_pci_reg_write32(mem, SOC_GLOBAL_RESET_ADDRESS, val);
 +      ath10k_pci_reg_write32(ar, SOC_GLOBAL_RESET_ADDRESS, val);
  
        for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
 -              if (!(ath10k_pci_reg_read32(mem, RTC_STATE_ADDRESS) &
 +              if (!(ath10k_pci_reg_read32(ar, RTC_STATE_ADDRESS) &
                                            RTC_STATE_COLD_RESET_MASK))
                        break;
                msleep(1);
        }
  
 -      ath10k_pci_reg_write32(mem, PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_RESET);
 +      ath10k_pci_reg_write32(ar, PCIE_SOC_WAKE_ADDRESS, PCIE_SOC_WAKE_RESET);
  }
  
  static void ath10k_pci_dump_features(struct ath10k_pci *ar_pci)
  
                switch (i) {
                case ATH10K_PCI_FEATURE_MSI_X:
 -                      ath10k_dbg(ATH10K_DBG_PCI, "device supports MSI-X\n");
 -                      break;
 -              case ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND:
 -                      ath10k_dbg(ATH10K_DBG_PCI, "QCA988X_1.0 workaround enabled\n");
 +                      ath10k_dbg(ATH10K_DBG_BOOT, "device supports MSI-X\n");
                        break;
                case ATH10K_PCI_FEATURE_SOC_POWER_SAVE:
 -                      ath10k_dbg(ATH10K_DBG_PCI, "QCA98XX SoC power save enabled\n");
 +                      ath10k_dbg(ATH10K_DBG_BOOT, "QCA98XX SoC power save enabled\n");
                        break;
                }
        }
@@@ -2346,7 -2286,7 +2346,7 @@@ static int ath10k_pci_probe(struct pci_
        int ret = 0;
        struct ath10k *ar;
        struct ath10k_pci *ar_pci;
 -      u32 lcr_val;
 +      u32 lcr_val, chip_id;
  
        ath10k_dbg(ATH10K_DBG_PCI, "%s\n", __func__);
  
        ar_pci->dev = &pdev->dev;
  
        switch (pci_dev->device) {
 -      case QCA988X_1_0_DEVICE_ID:
 -              set_bit(ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND, ar_pci->features);
 -              break;
        case QCA988X_2_0_DEVICE_ID:
                set_bit(ATH10K_PCI_FEATURE_MSI_X, ar_pci->features);
                break;
        default:
                ret = -ENODEV;
-               ath10k_err("Unkown device ID: %d\n", pci_dev->device);
+               ath10k_err("Unknown device ID: %d\n", pci_dev->device);
                goto err_ar_pci;
        }
  
                goto err_ar_pci;
        }
  
 -      /* Enable QCA988X_1.0 HW workarounds */
 -      if (test_bit(ATH10K_PCI_FEATURE_HW_1_0_WORKAROUND, ar_pci->features))
 -              spin_lock_init(&ar_pci->hw_v1_workaround_lock);
 -
        ar_pci->ar = ar;
        ar_pci->fw_indicator_address = FW_INDICATOR_ADDRESS;
        atomic_set(&ar_pci->keep_awake_count, 0);
  
        spin_lock_init(&ar_pci->ce_lock);
  
 -      ar_pci->cacheline_sz = dma_get_cache_alignment();
 +      ret = ath10k_do_pci_wake(ar);
 +      if (ret) {
 +              ath10k_err("Failed to get chip id: %d\n", ret);
 +              return ret;
 +      }
 +
 +      chip_id = ath10k_pci_read32(ar,
 +                                  RTC_SOC_BASE_ADDRESS + SOC_CHIP_ID_ADDRESS);
 +
 +      ath10k_do_pci_sleep(ar);
 +
 +      ath10k_dbg(ATH10K_DBG_BOOT, "boot pci_mem 0x%p\n", ar_pci->mem);
  
 -      ret = ath10k_core_register(ar);
 +      ret = ath10k_core_register(ar, chip_id);
        if (ret) {
                ath10k_err("could not register driver core (%d)\n", ret);
                goto err_iomap;
@@@ -2478,6 -2414,7 +2478,6 @@@ err_region
  err_device:
        pci_disable_device(pdev);
  err_ar:
 -      pci_set_drvdata(pdev, NULL);
        ath10k_core_destroy(ar);
  err_ar_pci:
        /* call HIF PCI free here */
@@@ -2505,6 -2442,7 +2505,6 @@@ static void ath10k_pci_remove(struct pc
  
        ath10k_core_unregister(ar);
  
 -      pci_set_drvdata(pdev, NULL);
        pci_iounmap(pdev, ar_pci->mem);
        pci_release_region(pdev, BAR_NUM);
        pci_clear_master(pdev);
@@@ -2545,6 -2483,9 +2545,6 @@@ module_exit(ath10k_pci_exit)
  MODULE_AUTHOR("Qualcomm Atheros");
  MODULE_DESCRIPTION("Driver support for Atheros QCA988X PCIe devices");
  MODULE_LICENSE("Dual BSD/GPL");
 -MODULE_FIRMWARE(QCA988X_HW_1_0_FW_DIR "/" QCA988X_HW_1_0_FW_FILE);
 -MODULE_FIRMWARE(QCA988X_HW_1_0_FW_DIR "/" QCA988X_HW_1_0_OTP_FILE);
 -MODULE_FIRMWARE(QCA988X_HW_1_0_FW_DIR "/" QCA988X_HW_1_0_BOARD_DATA_FILE);
  MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_FW_FILE);
  MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_OTP_FILE);
  MODULE_FIRMWARE(QCA988X_HW_2_0_FW_DIR "/" QCA988X_HW_2_0_BOARD_DATA_FILE);
index 23f8d1ce877d4e133fc690b7055b4342841e4112,035eb750e28cb37871be5d272f72e81e63d4690f..a00132e31ec7ab245f2017f13e110c6730c906fd
@@@ -481,7 -481,7 +481,7 @@@ static int tps65910_get_voltage_dcdc_se
  
        /* multiplier 0 == 1 but 2,3 normal */
        if (!mult)
 -              mult=1;
 +              mult = 1;
  
        if (sr) {
                /* normalise to valid range */
@@@ -685,7 -685,7 +685,7 @@@ static int tps65910_list_voltage_dcdc(s
        case TPS65910_REG_VDD2:
                mult = (selector / VDD1_2_NUM_VOLT_FINE) + 1;
                volt = VDD1_2_MIN_VOLT +
 -                              (selector % VDD1_2_NUM_VOLT_FINE) * VDD1_2_OFFSET;
 +                      (selector % VDD1_2_NUM_VOLT_FINE) * VDD1_2_OFFSET;
                break;
        case TPS65911_REG_VDDCTRL:
                volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET);
@@@ -703,7 -703,7 +703,7 @@@ static int tps65911_list_voltage(struc
        struct tps65910_reg *pmic = rdev_get_drvdata(dev);
        int step_mv = 0, id = rdev_get_id(dev);
  
 -      switch(id) {
 +      switch (id) {
        case TPS65911_REG_LDO1:
        case TPS65911_REG_LDO2:
        case TPS65911_REG_LDO4:
@@@ -906,7 -906,7 +906,7 @@@ static int tps65910_set_ext_sleep_confi
                }
                ret = tps65910_reg_write(pmic->mfd, sr_reg_add, 0);
                if (ret < 0) {
-                       dev_err(mfd->dev, "Error in settting sr register\n");
+                       dev_err(mfd->dev, "Error in setting sr register\n");
                        return ret;
                }
        }
@@@ -982,7 -982,7 +982,7 @@@ static struct tps65910_board *tps65910_
        }
  
        np = of_node_get(pdev->dev.parent->of_node);
 -      regulators = of_find_node_by_name(np, "regulators");
 +      regulators = of_get_child_by_name(np, "regulators");
        if (!regulators) {
                dev_err(&pdev->dev, "regulator node not found\n");
                return NULL;
@@@ -1074,7 -1074,7 +1074,7 @@@ static int tps65910_probe(struct platfo
        tps65910_reg_set_bits(pmic->mfd, TPS65910_DEVCTRL,
                                DEVCTRL_SR_CTL_I2C_SEL_MASK);
  
 -      switch(tps65910_chip_id(tps65910)) {
 +      switch (tps65910_chip_id(tps65910)) {
        case TPS65910:
                pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
                pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
                if (tps65910_reg_matches)
                        config.of_node = tps65910_reg_matches[i].of_node;
  
 -              rdev = regulator_register(&pmic->desc[i], &config);
 +              rdev = devm_regulator_register(&pdev->dev, &pmic->desc[i],
 +                                             &config);
                if (IS_ERR(rdev)) {
                        dev_err(tps65910->dev,
                                "failed to register %s regulator\n",
                                pdev->name);
 -                      err = PTR_ERR(rdev);
 -                      goto err_unregister_regulator;
 +                      return PTR_ERR(rdev);
                }
  
                /* Save regulator for cleanup */
                pmic->rdev[i] = rdev;
        }
        return 0;
 -
 -err_unregister_regulator:
 -      while (--i >= 0)
 -              regulator_unregister(pmic->rdev[i]);
 -      return err;
 -}
 -
 -static int tps65910_remove(struct platform_device *pdev)
 -{
 -      struct tps65910_reg *pmic = platform_get_drvdata(pdev);
 -      int i;
 -
 -      for (i = 0; i < pmic->num_regulators; i++)
 -              regulator_unregister(pmic->rdev[i]);
 -
 -      return 0;
  }
  
  static void tps65910_shutdown(struct platform_device *pdev)
@@@ -1228,6 -1244,7 +1228,6 @@@ static struct platform_driver tps65910_
                .owner = THIS_MODULE,
        },
        .probe = tps65910_probe,
 -      .remove = tps65910_remove,
        .shutdown = tps65910_shutdown,
  };
  
diff --combined drivers/scsi/bfa/bfad.c
index 7591fa4e28bb2be8ed6e6a64e972568429457f20,2e6e3ac2d41bc39129da559e313d12674868da9c..fc80a325a1e6577c8fb5225d9f8a7ea614311540
@@@ -766,20 -766,49 +766,20 @@@ bfad_pci_init(struct pci_dev *pdev, str
        bfad->pcidev = pdev;
  
        /* Adjust PCIe Maximum Read Request Size */
 -      if (pcie_max_read_reqsz > 0) {
 -              int pcie_cap_reg;
 -              u16 pcie_dev_ctl;
 -              u16 mask = 0xffff;
 -
 -              switch (pcie_max_read_reqsz) {
 -              case 128:
 -                      mask = 0x0;
 -                      break;
 -              case 256:
 -                      mask = 0x1000;
 -                      break;
 -              case 512:
 -                      mask = 0x2000;
 -                      break;
 -              case 1024:
 -                      mask = 0x3000;
 -                      break;
 -              case 2048:
 -                      mask = 0x4000;
 -                      break;
 -              case 4096:
 -                      mask = 0x5000;
 -                      break;
 -              default:
 -                      break;
 -              }
 -
 -              pcie_cap_reg = pci_find_capability(pdev, PCI_CAP_ID_EXP);
 -              if (mask != 0xffff && pcie_cap_reg) {
 -                      pcie_cap_reg += 0x08;
 -                      pci_read_config_word(pdev, pcie_cap_reg, &pcie_dev_ctl);
 -                      if ((pcie_dev_ctl & 0x7000) != mask) {
 -                              printk(KERN_WARNING "BFA[%s]: "
 +      if (pci_is_pcie(pdev) && pcie_max_read_reqsz) {
 +              if (pcie_max_read_reqsz >= 128 &&
 +                  pcie_max_read_reqsz <= 4096 &&
 +                  is_power_of_2(pcie_max_read_reqsz)) {
 +                      int max_rq = pcie_get_readrq(pdev);
 +                      printk(KERN_WARNING "BFA[%s]: "
                                "pcie_max_read_request_size is %d, "
 -                              "reset to %d\n", bfad->pci_name,
 -                              (1 << ((pcie_dev_ctl & 0x7000) >> 12)) << 7,
 +                              "reset to %d\n", bfad->pci_name, max_rq,
                                pcie_max_read_reqsz);
 -
 -                              pcie_dev_ctl &= ~0x7000;
 -                              pci_write_config_word(pdev, pcie_cap_reg,
 -                                              pcie_dev_ctl | mask);
 -                      }
 +                      pcie_set_readrq(pdev, pcie_max_read_reqsz);
 +              } else {
 +                      printk(KERN_WARNING "BFA[%s]: invalid "
 +                             "pcie_max_read_request_size %d ignored\n",
 +                             bfad->pci_name, pcie_max_read_reqsz);
                }
        }
  
@@@ -804,7 -833,6 +804,6 @@@ bfad_pci_uninit(struct pci_dev *pdev, s
        /* Disable PCIE Advanced Error Recovery (AER) */
        pci_disable_pcie_error_reporting(pdev);
        pci_disable_device(pdev);
-       pci_set_drvdata(pdev, NULL);
  }
  
  bfa_status_t
index 5be718c241c4f329edb1c23e684daa7b4681a0f1,886e2f9eb0ea37fb37c1f62b01a0f8034582da6f..e4cf23df4b4f094d64a40332c81facd39da4097c
@@@ -126,7 -126,7 +126,7 @@@ static void bnx2i_iscsi_license_error(s
  
  /**
   * bnx2i_arm_cq_event_coalescing - arms CQ to enable EQ notification
-  * @ep:               endpoint (transport indentifier) structure
+  * @ep:               endpoint (transport identifier) structure
   * @action:   action, ARM or DISARM. For now only ARM_CQE is used
   *
   * Arm'ing CQ will enable chip to generate global EQ events inorder to interrupt
@@@ -756,7 -756,7 +756,7 @@@ void bnx2i_send_cmd_cleanup_req(struct 
  /**
   * bnx2i_send_conn_destroy - initiates iscsi connection teardown process
   * @hba:      adapter structure pointer
-  * @ep:               endpoint (transport indentifier) structure
+  * @ep:               endpoint (transport identifier) structure
   *
   * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE to initiate
   *    iscsi connection context clean-up process
@@@ -791,7 -791,7 +791,7 @@@ int bnx2i_send_conn_destroy(struct bnx2
  /**
   * bnx2i_570x_send_conn_ofld_req - initiates iscsi conn context setup process
   * @hba:              adapter structure pointer
-  * @ep:               endpoint (transport indentifier) structure
+  * @ep:               endpoint (transport identifier) structure
   *
   * 5706/5708/5709 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
   */
@@@ -851,7 -851,7 +851,7 @@@ static int bnx2i_570x_send_conn_ofld_re
  /**
   * bnx2i_5771x_send_conn_ofld_req - initiates iscsi connection context creation
   * @hba:              adapter structure pointer
-  * @ep:               endpoint (transport indentifier) structure
+  * @ep:               endpoint (transport identifier) structure
   *
   * 57710 specific - prepares and posts CONN_OFLD_REQ1/2 KWQE
   */
@@@ -920,7 -920,7 +920,7 @@@ static int bnx2i_5771x_send_conn_ofld_r
   * bnx2i_send_conn_ofld_req - initiates iscsi connection context setup process
   *
   * @hba:              adapter structure pointer
-  * @ep:               endpoint (transport indentifier) structure
+  * @ep:               endpoint (transport identifier) structure
   *
   * this routine prepares and posts CONN_OFLD_REQ1/2 KWQE
   */
@@@ -939,7 -939,7 +939,7 @@@ int bnx2i_send_conn_ofld_req(struct bnx
  
  /**
   * setup_qp_page_tables - iscsi QP page table setup function
-  * @ep:               endpoint (transport indentifier) structure
+  * @ep:               endpoint (transport identifier) structure
   *
   * Sets up page tables for SQ/RQ/CQ, 1G/sec (5706/5708/5709) devices requires
   *    64-bit address in big endian format. Whereas 10G/sec (57710) requires
@@@ -1046,7 -1046,7 +1046,7 @@@ static void setup_qp_page_tables(struc
  /**
   * bnx2i_alloc_qp_resc - allocates required resources for QP.
   * @hba:      adapter structure pointer
-  * @ep:               endpoint (transport indentifier) structure
+  * @ep:               endpoint (transport identifier) structure
   *
   * Allocate QP (transport layer for iSCSI connection) resources, DMA'able
   *    memory for SQ/RQ/CQ and page tables. EP structure elements such
@@@ -1191,7 -1191,7 +1191,7 @@@ mem_alloc_err
  /**
   * bnx2i_free_qp_resc - free memory resources held by QP
   * @hba:      adapter structure pointer
-  * @ep:       endpoint (transport indentifier) structure
+  * @ep:       endpoint (transport identifier) structure
   *
   * Free QP resources - SQ/RQ/CQ memory and page tables.
   */
@@@ -2738,7 -2738,8 +2738,7 @@@ int bnx2i_map_ep_dbell_regs(struct bnx2
        if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) {
                reg_base = pci_resource_start(ep->hba->pcidev,
                                              BNX2X_DOORBELL_PCI_BAR);
 -              reg_off = BNX2I_5771X_DBELL_PAGE_SIZE * (cid_num & 0x1FFFF) +
 -                        DPM_TRIGER_TYPE;
 +              reg_off = (1 << BNX2X_DB_SHIFT) * (cid_num & 0x1FFFF);
                ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, 4);
                goto arm_cq;
        }
index bbf81ea3a25273a2e9cfacab90e28723d4471d8e,d08dc12082c95e6befeaa273ae1d110600c68420..889b594fe8b0d0cd2f7409613e8271e4c7cbdccd
@@@ -74,10 -74,6 +74,10 @@@ module_param(fnic_trace_max_pages, uint
  MODULE_PARM_DESC(fnic_trace_max_pages, "Total allocated memory pages "
                                        "for fnic trace buffer");
  
 +static unsigned int fnic_max_qdepth = FNIC_DFLT_QUEUE_DEPTH;
 +module_param(fnic_max_qdepth, uint, S_IRUGO|S_IWUSR);
 +MODULE_PARM_DESC(fnic_max_qdepth, "Queue depth to report for each LUN");
 +
  static struct libfc_function_template fnic_transport_template = {
        .frame_send = fnic_send,
        .lport_set_port_id = fnic_set_port_id,
@@@ -95,7 -91,7 +95,7 @@@ static int fnic_slave_alloc(struct scsi
        if (!rport || fc_remote_port_chkready(rport))
                return -ENXIO;
  
 -      scsi_activate_tcq(sdev, FNIC_DFLT_QUEUE_DEPTH);
 +      scsi_activate_tcq(sdev, fnic_max_qdepth);
        return 0;
  }
  
@@@ -130,7 -126,6 +130,7 @@@ fnic_set_rport_dev_loss_tmo(struct fc_r
  static void fnic_get_host_speed(struct Scsi_Host *shost);
  static struct scsi_transport_template *fnic_fc_transport;
  static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *);
 +static void fnic_reset_host_stats(struct Scsi_Host *);
  
  static struct fc_function_template fnic_fc_functions = {
  
        .set_rport_dev_loss_tmo = fnic_set_rport_dev_loss_tmo,
        .issue_fc_host_lip = fnic_reset,
        .get_fc_host_stats = fnic_get_stats,
 +      .reset_fc_host_stats = fnic_reset_host_stats,
        .dd_fcrport_size = sizeof(struct fc_rport_libfc_priv),
        .terminate_rport_io = fnic_terminate_rport_io,
        .bsg_request = fc_lport_bsg_request,
@@@ -212,116 -206,13 +212,116 @@@ static struct fc_host_statistics *fnic_
        stats->error_frames = vs->tx.tx_errors + vs->rx.rx_errors;
        stats->dumped_frames = vs->tx.tx_drops + vs->rx.rx_drop;
        stats->invalid_crc_count = vs->rx.rx_crc_errors;
 -      stats->seconds_since_last_reset = (jiffies - lp->boot_time) / HZ;
 +      stats->seconds_since_last_reset =
 +                      (jiffies - fnic->stats_reset_time) / HZ;
        stats->fcp_input_megabytes = div_u64(fnic->fcp_input_bytes, 1000000);
        stats->fcp_output_megabytes = div_u64(fnic->fcp_output_bytes, 1000000);
  
        return stats;
  }
  
 +/*
 + * fnic_dump_fchost_stats
 + * note : dumps fc_statistics into system logs
 + */
 +void fnic_dump_fchost_stats(struct Scsi_Host *host,
 +                              struct fc_host_statistics *stats)
 +{
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: seconds since last reset = %llu\n",
 +                      stats->seconds_since_last_reset);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: tx frames                = %llu\n",
 +                      stats->tx_frames);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: tx words         = %llu\n",
 +                      stats->tx_words);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: rx frames                = %llu\n",
 +                      stats->rx_frames);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: rx words         = %llu\n",
 +                      stats->rx_words);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: lip count                = %llu\n",
 +                      stats->lip_count);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: nos count                = %llu\n",
 +                      stats->nos_count);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: error frames             = %llu\n",
 +                      stats->error_frames);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: dumped frames    = %llu\n",
 +                      stats->dumped_frames);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: link failure count       = %llu\n",
 +                      stats->link_failure_count);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: loss of sync count       = %llu\n",
 +                      stats->loss_of_sync_count);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: loss of signal count     = %llu\n",
 +                      stats->loss_of_signal_count);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: prim seq protocol err count = %llu\n",
 +                      stats->prim_seq_protocol_err_count);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: invalid tx word count= %llu\n",
 +                      stats->invalid_tx_word_count);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: invalid crc count        = %llu\n",
 +                      stats->invalid_crc_count);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: fcp input requests       = %llu\n",
 +                      stats->fcp_input_requests);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: fcp output requests      = %llu\n",
 +                      stats->fcp_output_requests);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: fcp control requests     = %llu\n",
 +                      stats->fcp_control_requests);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: fcp input megabytes      = %llu\n",
 +                      stats->fcp_input_megabytes);
 +      FNIC_MAIN_NOTE(KERN_NOTICE, host,
 +                      "fnic: fcp output megabytes     = %llu\n",
 +                      stats->fcp_output_megabytes);
 +      return;
 +}
 +
 +/*
 + * fnic_reset_host_stats : clears host stats
 + * note : called when reset_statistics set under sysfs dir
 + */
 +static void fnic_reset_host_stats(struct Scsi_Host *host)
 +{
 +      int ret;
 +      struct fc_lport *lp = shost_priv(host);
 +      struct fnic *fnic = lport_priv(lp);
 +      struct fc_host_statistics *stats;
 +      unsigned long flags;
 +
 +      /* dump current stats, before clearing them */
 +      stats = fnic_get_stats(host);
 +      fnic_dump_fchost_stats(host, stats);
 +
 +      spin_lock_irqsave(&fnic->fnic_lock, flags);
 +      ret = vnic_dev_stats_clear(fnic->vdev);
 +      spin_unlock_irqrestore(&fnic->fnic_lock, flags);
 +
 +      if (ret) {
 +              FNIC_MAIN_DBG(KERN_DEBUG, fnic->lport->host,
 +                              "fnic: Reset vnic stats failed"
 +                              " 0x%x", ret);
 +              return;
 +      }
 +      fnic->stats_reset_time = jiffies;
 +      memset(stats, 0, sizeof(*stats));
 +
 +      return;
 +}
 +
  void fnic_log_q_error(struct fnic *fnic)
  {
        unsigned int i;
@@@ -556,6 -447,13 +556,6 @@@ static int fnic_probe(struct pci_dev *p
  
        host->transportt = fnic_fc_transport;
  
 -      err = scsi_init_shared_tag_map(host, FNIC_MAX_IO_REQ);
 -      if (err) {
 -              shost_printk(KERN_ERR, fnic->lport->host,
 -                           "Unable to alloc shared tag map\n");
 -              goto err_out_free_hba;
 -      }
 -
        /* Setup PCI resources */
        pci_set_drvdata(pdev, fnic);
  
        pci_set_master(pdev);
  
        /* Query PCI controller on system for DMA addressing
 -       * limitation for the device.  Try 40-bit first, and
 +       * limitation for the device.  Try 64-bit first, and
         * fail to 32-bit.
         */
 -      err = pci_set_dma_mask(pdev, DMA_BIT_MASK(40));
 +      err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
        if (err) {
                err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
                if (err) {
                        goto err_out_release_regions;
                }
        } else {
 -              err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(40));
 +              err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
                if (err) {
                        shost_printk(KERN_ERR, fnic->lport->host,
 -                                   "Unable to obtain 40-bit DMA "
 +                                   "Unable to obtain 64-bit DMA "
                                     "for consistent allocations, aborting.\n");
                        goto err_out_release_regions;
                }
                             "aborting.\n");
                goto err_out_dev_close;
        }
 +
 +      /* Configure Maximum Outstanding IO reqs*/
 +      if (fnic->config.io_throttle_count != FNIC_UCSM_DFLT_THROTTLE_CNT_BLD) {
 +              host->can_queue = min_t(u32, FNIC_MAX_IO_REQ,
 +                                      max_t(u32, FNIC_MIN_IO_REQ,
 +                                      fnic->config.io_throttle_count));
 +      }
 +      fnic->fnic_max_tag_id = host->can_queue;
 +
 +      err = scsi_init_shared_tag_map(host, fnic->fnic_max_tag_id);
 +      if (err) {
 +              shost_printk(KERN_ERR, fnic->lport->host,
 +                        "Unable to alloc shared tag map\n");
 +              goto err_out_dev_close;
 +      }
 +
        host->max_lun = fnic->config.luns_per_tgt;
        host->max_id = FNIC_MAX_FCP_TARGET;
        host->max_cmd_len = FCOE_MAX_CMD_LEN;
        }
  
        fc_lport_init_stats(lp);
 +      fnic->stats_reset_time = jiffies;
  
        fc_lport_config(lp);
  
@@@ -996,7 -877,6 +996,6 @@@ static void fnic_remove(struct pci_dev 
        fnic_iounmap(fnic);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
-       pci_set_drvdata(pdev, NULL);
        scsi_host_put(lp->host);
  }
  
diff --combined drivers/scsi/hpsa.c
index 891c86b66253b3272dbce9e816cb8bbe72bafab5,a4320bcc40f2b3d176c9515a99a4b261a6d1c97d..df72d4a58385f2c7f4e83b83d8cac84264e97cea
@@@ -54,7 -54,7 +54,7 @@@
  #include "hpsa.h"
  
  /* HPSA_DRIVER_VERSION must be 3 byte values (0-255) separated by '.' */
 -#define HPSA_DRIVER_VERSION "2.0.2-1"
 +#define HPSA_DRIVER_VERSION "3.4.0-1"
  #define DRIVER_NAME "HP HPSA Driver (v " HPSA_DRIVER_VERSION ")"
  #define HPSA "hpsa"
  
@@@ -89,14 -89,13 +89,14 @@@ static const struct pci_device_id hpsa_
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3245},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3247},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3249},
 -      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324a},
 -      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324b},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324A},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x324B},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSE,     0x103C, 0x3233},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x3350},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x3351},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x3352},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x3353},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x334D},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x3354},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x3355},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x3356},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSH,     0x103C, 0x1925},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSH,     0x103C, 0x1926},
        {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSH,     0x103C, 0x1928},
 -      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSF,     0x103C, 0x334d},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSH,     0x103C, 0x1929},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21BD},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21BE},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21BF},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C0},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C1},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C2},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C3},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C4},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C5},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C7},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C8},
 +      {PCI_VENDOR_ID_HP,     PCI_DEVICE_ID_HP_CISSI,     0x103C, 0x21C9},
        {PCI_VENDOR_ID_HP,     PCI_ANY_ID,      PCI_ANY_ID, PCI_ANY_ID,
                PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
        {0,}
@@@ -138,35 -125,24 +138,35 @@@ static struct board_type products[] = 
        {0x3245103C, "Smart Array P410i", &SA5_access},
        {0x3247103C, "Smart Array P411", &SA5_access},
        {0x3249103C, "Smart Array P812", &SA5_access},
 -      {0x324a103C, "Smart Array P712m", &SA5_access},
 -      {0x324b103C, "Smart Array P711m", &SA5_access},
 +      {0x324A103C, "Smart Array P712m", &SA5_access},
 +      {0x324B103C, "Smart Array P711m", &SA5_access},
        {0x3350103C, "Smart Array P222", &SA5_access},
        {0x3351103C, "Smart Array P420", &SA5_access},
        {0x3352103C, "Smart Array P421", &SA5_access},
        {0x3353103C, "Smart Array P822", &SA5_access},
 +      {0x334D103C, "Smart Array P822se", &SA5_access},
        {0x3354103C, "Smart Array P420i", &SA5_access},
        {0x3355103C, "Smart Array P220i", &SA5_access},
        {0x3356103C, "Smart Array P721m", &SA5_access},
 -      {0x1920103C, "Smart Array", &SA5_access},
 -      {0x1921103C, "Smart Array", &SA5_access},
 -      {0x1922103C, "Smart Array", &SA5_access},
 -      {0x1923103C, "Smart Array", &SA5_access},
 -      {0x1924103C, "Smart Array", &SA5_access},
 -      {0x1925103C, "Smart Array", &SA5_access},
 -      {0x1926103C, "Smart Array", &SA5_access},
 -      {0x1928103C, "Smart Array", &SA5_access},
 -      {0x334d103C, "Smart Array P822se", &SA5_access},
 +      {0x1921103C, "Smart Array P830i", &SA5_access},
 +      {0x1922103C, "Smart Array P430", &SA5_access},
 +      {0x1923103C, "Smart Array P431", &SA5_access},
 +      {0x1924103C, "Smart Array P830", &SA5_access},
 +      {0x1926103C, "Smart Array P731m", &SA5_access},
 +      {0x1928103C, "Smart Array P230i", &SA5_access},
 +      {0x1929103C, "Smart Array P530", &SA5_access},
 +      {0x21BD103C, "Smart Array", &SA5_access},
 +      {0x21BE103C, "Smart Array", &SA5_access},
 +      {0x21BF103C, "Smart Array", &SA5_access},
 +      {0x21C0103C, "Smart Array", &SA5_access},
 +      {0x21C1103C, "Smart Array", &SA5_access},
 +      {0x21C2103C, "Smart Array", &SA5_access},
 +      {0x21C3103C, "Smart Array", &SA5_access},
 +      {0x21C4103C, "Smart Array", &SA5_access},
 +      {0x21C5103C, "Smart Array", &SA5_access},
 +      {0x21C7103C, "Smart Array", &SA5_access},
 +      {0x21C8103C, "Smart Array", &SA5_access},
 +      {0x21C9103C, "Smart Array", &SA5_access},
        {0xFFFF103C, "Unknown Smart Array", &SA5_access},
  };
  
@@@ -5018,7 -4994,6 +5018,6 @@@ static void hpsa_remove_one(struct pci_
        kfree(h->hba_inquiry_data);
        pci_disable_device(pdev);
        pci_release_regions(pdev);
-       pci_set_drvdata(pdev, NULL);
        kfree(h);
  }
  
index 647f5bfb3bd33f312135a869b8ee0793a879a7a8,c1fca8df6355e28fa6056616dbc52ba66290edb7..3dfd38ce806c0df6f8196814886bd836b0dc18f6
@@@ -3031,10 -3031,10 +3031,10 @@@ lpfc_sli4_xri_sgl_update(struct lpfc_hb
                        phba->sli4_hba.scsi_xri_max);
  
        spin_lock_irq(&phba->scsi_buf_list_get_lock);
 -      spin_lock_irq(&phba->scsi_buf_list_put_lock);
 +      spin_lock(&phba->scsi_buf_list_put_lock);
        list_splice_init(&phba->lpfc_scsi_buf_list_get, &scsi_sgl_list);
        list_splice(&phba->lpfc_scsi_buf_list_put, &scsi_sgl_list);
 -      spin_unlock_irq(&phba->scsi_buf_list_put_lock);
 +      spin_unlock(&phba->scsi_buf_list_put_lock);
        spin_unlock_irq(&phba->scsi_buf_list_get_lock);
  
        if (phba->sli4_hba.scsi_xri_cnt > phba->sli4_hba.scsi_xri_max) {
                psb->cur_iocbq.sli4_xritag = phba->sli4_hba.xri_ids[lxri];
        }
        spin_lock_irq(&phba->scsi_buf_list_get_lock);
 -      spin_lock_irq(&phba->scsi_buf_list_put_lock);
 +      spin_lock(&phba->scsi_buf_list_put_lock);
        list_splice_init(&scsi_sgl_list, &phba->lpfc_scsi_buf_list_get);
        INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list_put);
 -      spin_unlock_irq(&phba->scsi_buf_list_put_lock);
 +      spin_unlock(&phba->scsi_buf_list_put_lock);
        spin_unlock_irq(&phba->scsi_buf_list_get_lock);
  
        return 0;
@@@ -4581,8 -4581,6 +4581,6 @@@ lpfc_disable_pci_dev(struct lpfc_hba *p
        /* Release PCI resource and disable PCI device */
        pci_release_selected_regions(pdev, bars);
        pci_disable_device(pdev);
-       /* Null out PCI private reference to driver */
-       pci_set_drvdata(pdev, NULL);
  
        return;
  }
@@@ -4859,9 -4857,6 +4857,9 @@@ lpfc_sli4_driver_resource_setup(struct 
        struct lpfc_mqe *mqe;
        int longs;
  
 +      /* Get all the module params for configuring this host */
 +      lpfc_get_cfgparam(phba);
 +
        /* Before proceed, wait for POST done and device ready */
        rc = lpfc_sli4_post_status_check(phba);
        if (rc)
                sizeof(struct lpfc_mbox_ext_buf_ctx));
        INIT_LIST_HEAD(&phba->mbox_ext_buf_ctx.ext_dmabuf_list);
  
 -      /*
 -       * We need to do a READ_CONFIG mailbox command here before
 -       * calling lpfc_get_cfgparam. For VFs this will report the
 -       * MAX_XRI, MAX_VPI, MAX_RPI, MAX_IOCB, and MAX_VFI settings.
 -       * All of the resources allocated
 -       * for this Port are tied to these values.
 -       */
 -      /* Get all the module params for configuring this host */
 -      lpfc_get_cfgparam(phba);
        phba->max_vpi = LPFC_MAX_VPI;
  
        /* This will be set to correct value after the read_config mbox */
@@@ -7135,6 -7139,19 +7133,6 @@@ lpfc_sli4_queue_destroy(struct lpfc_hb
                phba->sli4_hba.fcp_wq = NULL;
        }
  
 -      if (phba->pci_bar0_memmap_p) {
 -              iounmap(phba->pci_bar0_memmap_p);
 -              phba->pci_bar0_memmap_p = NULL;
 -      }
 -      if (phba->pci_bar2_memmap_p) {
 -              iounmap(phba->pci_bar2_memmap_p);
 -              phba->pci_bar2_memmap_p = NULL;
 -      }
 -      if (phba->pci_bar4_memmap_p) {
 -              iounmap(phba->pci_bar4_memmap_p);
 -              phba->pci_bar4_memmap_p = NULL;
 -      }
 -
        /* Release FCP CQ mapping array */
        if (phba->sli4_hba.fcp_cq_map != NULL) {
                kfree(phba->sli4_hba.fcp_cq_map);
@@@ -7923,9 -7940,9 +7921,9 @@@ lpfc_sli4_pci_mem_setup(struct lpfc_hb
         * particular PCI BARs regions is dependent on the type of
         * SLI4 device.
         */
 -      if (pci_resource_start(pdev, 0)) {
 -              phba->pci_bar0_map = pci_resource_start(pdev, 0);
 -              bar0map_len = pci_resource_len(pdev, 0);
 +      if (pci_resource_start(pdev, PCI_64BIT_BAR0)) {
 +              phba->pci_bar0_map = pci_resource_start(pdev, PCI_64BIT_BAR0);
 +              bar0map_len = pci_resource_len(pdev, PCI_64BIT_BAR0);
  
                /*
                 * Map SLI4 PCI Config Space Register base to a kernel virtual
                                   "registers.\n");
                        goto out;
                }
 +              phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p;
                /* Set up BAR0 PCI config space register memory map */
                lpfc_sli4_bar0_register_memmap(phba, if_type);
        } else {
        }
  
        if ((if_type == LPFC_SLI_INTF_IF_TYPE_0) &&
 -          (pci_resource_start(pdev, 2))) {
 +          (pci_resource_start(pdev, PCI_64BIT_BAR2))) {
                /*
                 * Map SLI4 if type 0 HBA Control Register base to a kernel
                 * virtual address and setup the registers.
                 */
 -              phba->pci_bar1_map = pci_resource_start(pdev, 2);
 -              bar1map_len = pci_resource_len(pdev, 2);
 +              phba->pci_bar1_map = pci_resource_start(pdev, PCI_64BIT_BAR2);
 +              bar1map_len = pci_resource_len(pdev, PCI_64BIT_BAR2);
                phba->sli4_hba.ctrl_regs_memmap_p =
                                ioremap(phba->pci_bar1_map, bar1map_len);
                if (!phba->sli4_hba.ctrl_regs_memmap_p) {
                           "ioremap failed for SLI4 HBA control registers.\n");
                        goto out_iounmap_conf;
                }
 +              phba->pci_bar2_memmap_p = phba->sli4_hba.ctrl_regs_memmap_p;
                lpfc_sli4_bar1_register_memmap(phba);
        }
  
        if ((if_type == LPFC_SLI_INTF_IF_TYPE_0) &&
 -          (pci_resource_start(pdev, 4))) {
 +          (pci_resource_start(pdev, PCI_64BIT_BAR4))) {
                /*
                 * Map SLI4 if type 0 HBA Doorbell Register base to a kernel
                 * virtual address and setup the registers.
                 */
 -              phba->pci_bar2_map = pci_resource_start(pdev, 4);
 -              bar2map_len = pci_resource_len(pdev, 4);
 +              phba->pci_bar2_map = pci_resource_start(pdev, PCI_64BIT_BAR4);
 +              bar2map_len = pci_resource_len(pdev, PCI_64BIT_BAR4);
                phba->sli4_hba.drbl_regs_memmap_p =
                                ioremap(phba->pci_bar2_map, bar2map_len);
                if (!phba->sli4_hba.drbl_regs_memmap_p) {
                           "ioremap failed for SLI4 HBA doorbell registers.\n");
                        goto out_iounmap_ctrl;
                }
 +              phba->pci_bar4_memmap_p = phba->sli4_hba.drbl_regs_memmap_p;
                error = lpfc_sli4_bar2_register_memmap(phba, LPFC_VF0);
                if (error)
                        goto out_iounmap_all;
@@@ -8389,8 -8403,7 +8387,8 @@@ static in
  lpfc_sli4_set_affinity(struct lpfc_hba *phba, int vectors)
  {
        int i, idx, saved_chann, used_chann, cpu, phys_id;
 -      int max_phys_id, num_io_channel, first_cpu;
 +      int max_phys_id, min_phys_id;
 +      int num_io_channel, first_cpu, chan;
        struct lpfc_vector_map_info *cpup;
  #ifdef CONFIG_X86
        struct cpuinfo_x86 *cpuinfo;
                phba->sli4_hba.num_present_cpu));
  
        max_phys_id = 0;
 +      min_phys_id = 0xff;
        phys_id = 0;
        num_io_channel = 0;
        first_cpu = LPFC_VECTOR_MAP_EMPTY;
  
                if (cpup->phys_id > max_phys_id)
                        max_phys_id = cpup->phys_id;
 +              if (cpup->phys_id < min_phys_id)
 +                      min_phys_id = cpup->phys_id;
                cpup++;
        }
  
 +      phys_id = min_phys_id;
        /* Now associate the HBA vectors with specific CPUs */
        for (idx = 0; idx < vectors; idx++) {
                cpup = phba->sli4_hba.cpu_map;
                        for (i = 1; i < max_phys_id; i++) {
                                phys_id++;
                                if (phys_id > max_phys_id)
 -                                      phys_id = 0;
 +                                      phys_id = min_phys_id;
                                cpu = lpfc_find_next_cpu(phba, phys_id);
                                if (cpu == LPFC_VECTOR_MAP_EMPTY)
                                        continue;
                                goto found;
                        }
  
 +                      /* Use round robin for scheduling */
 +                      phba->cfg_fcp_io_sched = LPFC_FCP_SCHED_ROUND_ROBIN;
 +                      chan = 0;
 +                      cpup = phba->sli4_hba.cpu_map;
 +                      for (i = 0; i < phba->sli4_hba.num_present_cpu; i++) {
 +                              cpup->channel_id = chan;
 +                              cpup++;
 +                              chan++;
 +                              if (chan >= phba->cfg_fcp_io_channel)
 +                                      chan = 0;
 +                      }
 +
                        lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                        "3329 Cannot set affinity:"
                                        "Error mapping vector %d (%d)\n",
@@@ -8504,7 -8501,7 +8502,7 @@@ found
                /* Spread vector mapping across multple physical CPU nodes */
                phys_id++;
                if (phys_id > max_phys_id)
 -                      phys_id = 0;
 +                      phys_id = min_phys_id;
        }
  
        /*
         * Base the remaining IO channel assigned, to IO channels already
         * assigned to other CPUs on the same phys_id.
         */
 -      for (i = 0; i <= max_phys_id; i++) {
 +      for (i = min_phys_id; i <= max_phys_id; i++) {
                /*
                 * If there are no io channels already mapped to
                 * this phys_id, just round robin thru the io_channels.
        if (num_io_channel != phba->sli4_hba.num_present_cpu)
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
                                "3333 Set affinity mismatch:"
 -                              "%d chann != %d cpus: %d vactors\n",
 +                              "%d chann != %d cpus: %d vectors\n",
                                num_io_channel, phba->sli4_hba.num_present_cpu,
                                vectors);
  
 +      /* Enable using cpu affinity for scheduling */
        phba->cfg_fcp_io_sched = LPFC_FCP_SCHED_BY_CPU;
        return 1;
  }
@@@ -8691,12 -8687,9 +8689,12 @@@ enable_msix_vectors
  
  cfg_fail_out:
        /* free the irq already requested */
 -      for (--index; index >= 0; index--)
 +      for (--index; index >= 0; index--) {
 +              irq_set_affinity_hint(phba->sli4_hba.msix_entries[index].
 +                                        vector, NULL);
                free_irq(phba->sli4_hba.msix_entries[index].vector,
                         &phba->sli4_hba.fcp_eq_hdl[index]);
 +      }
  
  msi_fail_out:
        /* Unconfigure MSI-X capability structure */
@@@ -8717,12 -8710,9 +8715,12 @@@ lpfc_sli4_disable_msix(struct lpfc_hba 
        int index;
  
        /* Free up MSI-X multi-message vectors */
 -      for (index = 0; index < phba->cfg_fcp_io_channel; index++)
 +      for (index = 0; index < phba->cfg_fcp_io_channel; index++) {
 +              irq_set_affinity_hint(phba->sli4_hba.msix_entries[index].
 +                                        vector, NULL);
                free_irq(phba->sli4_hba.msix_entries[index].vector,
                         &phba->sli4_hba.fcp_eq_hdl[index]);
 +      }
  
        /* Disable MSI-X */
        pci_disable_msix(phba->pcidev);
@@@ -9429,7 -9419,6 +9427,6 @@@ lpfc_pci_remove_one_s3(struct pci_dev *
        /* Disable interrupt */
        lpfc_sli_disable_intr(phba);
  
-       pci_set_drvdata(pdev, NULL);
        scsi_host_put(shost);
  
        /*
index 3020921a474671e6c9845ba26979d56c389a96c3,fdd13ef8124f1ce6a5226efd0085187719978e51..a6efc1e088ec322b0d9cbe9963813608c3438be1
@@@ -18,7 -18,7 +18,7 @@@
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   *
   *  FILE: megaraid_sas_base.c
 - *  Version : 06.600.18.00-rc1
 + *  Version : 06.700.06.00-rc1
   *
   *  Authors: LSI Corporation
   *           Sreenivas Bagalkote
@@@ -92,8 -92,6 +92,8 @@@ MODULE_DESCRIPTION("LSI MegaRAID SAS Dr
  
  int megasas_transition_to_ready(struct megasas_instance *instance, int ocr);
  static int megasas_get_pd_list(struct megasas_instance *instance);
 +static int megasas_ld_list_query(struct megasas_instance *instance,
 +                               u8 query_type);
  static int megasas_issue_init_mfi(struct megasas_instance *instance);
  static int megasas_register_aen(struct megasas_instance *instance,
                                u32 seq_num, u32 class_locale_word);
@@@ -376,11 -374,13 +376,11 @@@ static in
  megasas_check_reset_xscale(struct megasas_instance *instance,
                struct megasas_register_set __iomem *regs)
  {
 -      u32 consumer;
 -      consumer = *instance->consumer;
  
        if ((instance->adprecovery != MEGASAS_HBA_OPERATIONAL) &&
 -              (*instance->consumer == MEGASAS_ADPRESET_INPROG_SIGN)) {
 +          (le32_to_cpu(*instance->consumer) ==
 +              MEGASAS_ADPRESET_INPROG_SIGN))
                return 1;
 -      }
        return 0;
  }
  
@@@ -629,10 -629,9 +629,10 @@@ megasas_fire_cmd_skinny(struct megasas_
  {
        unsigned long flags;
        spin_lock_irqsave(&instance->hba_lock, flags);
 -      writel(0, &(regs)->inbound_high_queue_port);
 -      writel((frame_phys_addr | (frame_count<<1))|1,
 -              &(regs)->inbound_low_queue_port);
 +      writel(upper_32_bits(frame_phys_addr),
 +             &(regs)->inbound_high_queue_port);
 +      writel((lower_32_bits(frame_phys_addr) | (frame_count<<1))|1,
 +             &(regs)->inbound_low_queue_port);
        spin_unlock_irqrestore(&instance->hba_lock, flags);
  }
  
@@@ -880,8 -879,8 +880,8 @@@ megasas_issue_polled(struct megasas_ins
  
        struct megasas_header *frame_hdr = &cmd->frame->hdr;
  
 -      frame_hdr->cmd_status = 0xFF;
 -      frame_hdr->flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE;
 +      frame_hdr->cmd_status = MFI_CMD_STATUS_POLL_MODE;
 +      frame_hdr->flags |= cpu_to_le16(MFI_FRAME_DONT_POST_IN_REPLY_QUEUE);
  
        /*
         * Issue the frame using inbound queue port
@@@ -945,12 -944,10 +945,12 @@@ megasas_issue_blocked_abort_cmd(struct 
         */
        abort_fr->cmd = MFI_CMD_ABORT;
        abort_fr->cmd_status = 0xFF;
 -      abort_fr->flags = 0;
 -      abort_fr->abort_context = cmd_to_abort->index;
 -      abort_fr->abort_mfi_phys_addr_lo = cmd_to_abort->frame_phys_addr;
 -      abort_fr->abort_mfi_phys_addr_hi = 0;
 +      abort_fr->flags = cpu_to_le16(0);
 +      abort_fr->abort_context = cpu_to_le32(cmd_to_abort->index);
 +      abort_fr->abort_mfi_phys_addr_lo =
 +              cpu_to_le32(lower_32_bits(cmd_to_abort->frame_phys_addr));
 +      abort_fr->abort_mfi_phys_addr_hi =
 +              cpu_to_le32(upper_32_bits(cmd_to_abort->frame_phys_addr));
  
        cmd->sync_cmd = 1;
        cmd->cmd_status = 0xFF;
@@@ -989,8 -986,8 +989,8 @@@ megasas_make_sgl32(struct megasas_insta
  
        if (sge_count) {
                scsi_for_each_sg(scp, os_sgl, sge_count, i) {
 -                      mfi_sgl->sge32[i].length = sg_dma_len(os_sgl);
 -                      mfi_sgl->sge32[i].phys_addr = sg_dma_address(os_sgl);
 +                      mfi_sgl->sge32[i].length = cpu_to_le32(sg_dma_len(os_sgl));
 +                      mfi_sgl->sge32[i].phys_addr = cpu_to_le32(sg_dma_address(os_sgl));
                }
        }
        return sge_count;
@@@ -1018,8 -1015,8 +1018,8 @@@ megasas_make_sgl64(struct megasas_insta
  
        if (sge_count) {
                scsi_for_each_sg(scp, os_sgl, sge_count, i) {
 -                      mfi_sgl->sge64[i].length = sg_dma_len(os_sgl);
 -                      mfi_sgl->sge64[i].phys_addr = sg_dma_address(os_sgl);
 +                      mfi_sgl->sge64[i].length = cpu_to_le32(sg_dma_len(os_sgl));
 +                      mfi_sgl->sge64[i].phys_addr = cpu_to_le64(sg_dma_address(os_sgl));
                }
        }
        return sge_count;
@@@ -1046,11 -1043,10 +1046,11 @@@ megasas_make_sgl_skinny(struct megasas_
  
        if (sge_count) {
                scsi_for_each_sg(scp, os_sgl, sge_count, i) {
 -                      mfi_sgl->sge_skinny[i].length = sg_dma_len(os_sgl);
 +                      mfi_sgl->sge_skinny[i].length =
 +                              cpu_to_le32(sg_dma_len(os_sgl));
                        mfi_sgl->sge_skinny[i].phys_addr =
 -                                              sg_dma_address(os_sgl);
 -                      mfi_sgl->sge_skinny[i].flag = 0;
 +                              cpu_to_le64(sg_dma_address(os_sgl));
 +                      mfi_sgl->sge_skinny[i].flag = cpu_to_le32(0);
                }
        }
        return sge_count;
@@@ -1159,8 -1155,8 +1159,8 @@@ megasas_build_dcdb(struct megasas_insta
        pthru->cdb_len = scp->cmd_len;
        pthru->timeout = 0;
        pthru->pad_0 = 0;
 -      pthru->flags = flags;
 -      pthru->data_xfer_len = scsi_bufflen(scp);
 +      pthru->flags = cpu_to_le16(flags);
 +      pthru->data_xfer_len = cpu_to_le32(scsi_bufflen(scp));
  
        memcpy(pthru->cdb, scp->cmnd, scp->cmd_len);
  
                if ((scp->request->timeout / HZ) > 0xFFFF)
                        pthru->timeout = 0xFFFF;
                else
 -                      pthru->timeout = scp->request->timeout / HZ;
 +                      pthru->timeout = cpu_to_le16(scp->request->timeout / HZ);
        }
  
        /*
         * Construct SGL
         */
        if (instance->flag_ieee == 1) {
 -              pthru->flags |= MFI_FRAME_SGL64;
 +              pthru->flags |= cpu_to_le16(MFI_FRAME_SGL64);
                pthru->sge_count = megasas_make_sgl_skinny(instance, scp,
                                                      &pthru->sgl);
        } else if (IS_DMA64) {
 -              pthru->flags |= MFI_FRAME_SGL64;
 +              pthru->flags |= cpu_to_le16(MFI_FRAME_SGL64);
                pthru->sge_count = megasas_make_sgl64(instance, scp,
                                                      &pthru->sgl);
        } else
         * Sense info specific
         */
        pthru->sense_len = SCSI_SENSE_BUFFERSIZE;
 -      pthru->sense_buf_phys_addr_hi = 0;
 -      pthru->sense_buf_phys_addr_lo = cmd->sense_phys_addr;
 +      pthru->sense_buf_phys_addr_hi =
 +              cpu_to_le32(upper_32_bits(cmd->sense_phys_addr));
 +      pthru->sense_buf_phys_addr_lo =
 +              cpu_to_le32(lower_32_bits(cmd->sense_phys_addr));
  
        /*
         * Compute the total number of frames this command consumes. FW uses
@@@ -1254,7 -1248,7 +1254,7 @@@ megasas_build_ldio(struct megasas_insta
        ldio->timeout = 0;
        ldio->reserved_0 = 0;
        ldio->pad_0 = 0;
 -      ldio->flags = flags;
 +      ldio->flags = cpu_to_le16(flags);
        ldio->start_lba_hi = 0;
        ldio->access_byte = (scp->cmd_len != 6) ? scp->cmnd[1] : 0;
  
         * 6-byte READ(0x08) or WRITE(0x0A) cdb
         */
        if (scp->cmd_len == 6) {
 -              ldio->lba_count = (u32) scp->cmnd[4];
 -              ldio->start_lba_lo = ((u32) scp->cmnd[1] << 16) |
 -                  ((u32) scp->cmnd[2] << 8) | (u32) scp->cmnd[3];
 +              ldio->lba_count = cpu_to_le32((u32) scp->cmnd[4]);
 +              ldio->start_lba_lo = cpu_to_le32(((u32) scp->cmnd[1] << 16) |
 +                                               ((u32) scp->cmnd[2] << 8) |
 +                                               (u32) scp->cmnd[3]);
  
 -              ldio->start_lba_lo &= 0x1FFFFF;
 +              ldio->start_lba_lo &= cpu_to_le32(0x1FFFFF);
        }
  
        /*
         * 10-byte READ(0x28) or WRITE(0x2A) cdb
         */
        else if (scp->cmd_len == 10) {
 -              ldio->lba_count = (u32) scp->cmnd[8] |
 -                  ((u32) scp->cmnd[7] << 8);
 -              ldio->start_lba_lo = ((u32) scp->cmnd[2] << 24) |
 -                  ((u32) scp->cmnd[3] << 16) |
 -                  ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5];
 +              ldio->lba_count = cpu_to_le32((u32) scp->cmnd[8] |
 +                                            ((u32) scp->cmnd[7] << 8));
 +              ldio->start_lba_lo = cpu_to_le32(((u32) scp->cmnd[2] << 24) |
 +                                               ((u32) scp->cmnd[3] << 16) |
 +                                               ((u32) scp->cmnd[4] << 8) |
 +                                               (u32) scp->cmnd[5]);
        }
  
        /*
         * 12-byte READ(0xA8) or WRITE(0xAA) cdb
         */
        else if (scp->cmd_len == 12) {
 -              ldio->lba_count = ((u32) scp->cmnd[6] << 24) |
 -                  ((u32) scp->cmnd[7] << 16) |
 -                  ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9];
 +              ldio->lba_count = cpu_to_le32(((u32) scp->cmnd[6] << 24) |
 +                                            ((u32) scp->cmnd[7] << 16) |
 +                                            ((u32) scp->cmnd[8] << 8) |
 +                                            (u32) scp->cmnd[9]);
  
 -              ldio->start_lba_lo = ((u32) scp->cmnd[2] << 24) |
 -                  ((u32) scp->cmnd[3] << 16) |
 -                  ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5];
 +              ldio->start_lba_lo = cpu_to_le32(((u32) scp->cmnd[2] << 24) |
 +                                               ((u32) scp->cmnd[3] << 16) |
 +                                               ((u32) scp->cmnd[4] << 8) |
 +                                               (u32) scp->cmnd[5]);
        }
  
        /*
         * 16-byte READ(0x88) or WRITE(0x8A) cdb
         */
        else if (scp->cmd_len == 16) {
 -              ldio->lba_count = ((u32) scp->cmnd[10] << 24) |
 -                  ((u32) scp->cmnd[11] << 16) |
 -                  ((u32) scp->cmnd[12] << 8) | (u32) scp->cmnd[13];
 +              ldio->lba_count = cpu_to_le32(((u32) scp->cmnd[10] << 24) |
 +                                            ((u32) scp->cmnd[11] << 16) |
 +                                            ((u32) scp->cmnd[12] << 8) |
 +                                            (u32) scp->cmnd[13]);
  
 -              ldio->start_lba_lo = ((u32) scp->cmnd[6] << 24) |
 -                  ((u32) scp->cmnd[7] << 16) |
 -                  ((u32) scp->cmnd[8] << 8) | (u32) scp->cmnd[9];
 +              ldio->start_lba_lo = cpu_to_le32(((u32) scp->cmnd[6] << 24) |
 +                                               ((u32) scp->cmnd[7] << 16) |
 +                                               ((u32) scp->cmnd[8] << 8) |
 +                                               (u32) scp->cmnd[9]);
  
 -              ldio->start_lba_hi = ((u32) scp->cmnd[2] << 24) |
 -                  ((u32) scp->cmnd[3] << 16) |
 -                  ((u32) scp->cmnd[4] << 8) | (u32) scp->cmnd[5];
 +              ldio->start_lba_hi = cpu_to_le32(((u32) scp->cmnd[2] << 24) |
 +                                               ((u32) scp->cmnd[3] << 16) |
 +                                               ((u32) scp->cmnd[4] << 8) |
 +                                               (u32) scp->cmnd[5]);
  
        }
  
         * Construct SGL
         */
        if (instance->flag_ieee) {
 -              ldio->flags |= MFI_FRAME_SGL64;
 +              ldio->flags |= cpu_to_le16(MFI_FRAME_SGL64);
                ldio->sge_count = megasas_make_sgl_skinny(instance, scp,
                                              &ldio->sgl);
        } else if (IS_DMA64) {
 -              ldio->flags |= MFI_FRAME_SGL64;
 +              ldio->flags |= cpu_to_le16(MFI_FRAME_SGL64);
                ldio->sge_count = megasas_make_sgl64(instance, scp, &ldio->sgl);
        } else
                ldio->sge_count = megasas_make_sgl32(instance, scp, &ldio->sgl);
         */
        ldio->sense_len = SCSI_SENSE_BUFFERSIZE;
        ldio->sense_buf_phys_addr_hi = 0;
 -      ldio->sense_buf_phys_addr_lo = cmd->sense_phys_addr;
 +      ldio->sense_buf_phys_addr_lo = cpu_to_le32(cmd->sense_phys_addr);
  
        /*
         * Compute the total number of frames this command consumes. FW uses
@@@ -1413,32 -1400,20 +1413,32 @@@ megasas_dump_pending_frames(struct mega
                        ldio = (struct megasas_io_frame *)cmd->frame;
                        mfi_sgl = &ldio->sgl;
                        sgcount = ldio->sge_count;
 -                      printk(KERN_ERR "megasas[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x, lba lo : 0x%x, lba_hi : 0x%x, sense_buf addr : 0x%x,sge count : 0x%x\n",instance->host->host_no, cmd->frame_count,ldio->cmd,ldio->target_id, ldio->start_lba_lo,ldio->start_lba_hi,ldio->sense_buf_phys_addr_lo,sgcount);
 +                      printk(KERN_ERR "megasas[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x,"
 +                      " lba lo : 0x%x, lba_hi : 0x%x, sense_buf addr : 0x%x,sge count : 0x%x\n",
 +                      instance->host->host_no, cmd->frame_count, ldio->cmd, ldio->target_id,
 +                      le32_to_cpu(ldio->start_lba_lo), le32_to_cpu(ldio->start_lba_hi),
 +                      le32_to_cpu(ldio->sense_buf_phys_addr_lo), sgcount);
                }
                else {
                        pthru = (struct megasas_pthru_frame *) cmd->frame;
                        mfi_sgl = &pthru->sgl;
                        sgcount = pthru->sge_count;
 -                      printk(KERN_ERR "megasas[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x, lun : 0x%x, cdb_len : 0x%x, data xfer len : 0x%x, sense_buf addr : 0x%x,sge count : 0x%x\n",instance->host->host_no,cmd->frame_count,pthru->cmd,pthru->target_id,pthru->lun,pthru->cdb_len , pthru->data_xfer_len,pthru->sense_buf_phys_addr_lo,sgcount);
 +                      printk(KERN_ERR "megasas[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x, "
 +                      "lun : 0x%x, cdb_len : 0x%x, data xfer len : 0x%x, sense_buf addr : 0x%x,sge count : 0x%x\n",
 +                      instance->host->host_no, cmd->frame_count, pthru->cmd, pthru->target_id,
 +                      pthru->lun, pthru->cdb_len, le32_to_cpu(pthru->data_xfer_len),
 +                      le32_to_cpu(pthru->sense_buf_phys_addr_lo), sgcount);
                }
        if(megasas_dbg_lvl & MEGASAS_DBG_LVL){
                for (n = 0; n < sgcount; n++){
                        if (IS_DMA64)
 -                              printk(KERN_ERR "megasas: sgl len : 0x%x, sgl addr : 0x%08lx ",mfi_sgl->sge64[n].length , (unsigned long)mfi_sgl->sge64[n].phys_addr) ;
 +                              printk(KERN_ERR "megasas: sgl len : 0x%x, sgl addr : 0x%llx ",
 +                                      le32_to_cpu(mfi_sgl->sge64[n].length),
 +                                      le64_to_cpu(mfi_sgl->sge64[n].phys_addr));
                        else
 -                              printk(KERN_ERR "megasas: sgl len : 0x%x, sgl addr : 0x%x ",mfi_sgl->sge32[n].length , mfi_sgl->sge32[n].phys_addr) ;
 +                              printk(KERN_ERR "megasas: sgl len : 0x%x, sgl addr : 0x%x ",
 +                                      le32_to_cpu(mfi_sgl->sge32[n].length),
 +                                      le32_to_cpu(mfi_sgl->sge32[n].phys_addr));
                        }
                }
                printk(KERN_ERR "\n");
@@@ -1699,11 -1674,11 +1699,11 @@@ static void megasas_complete_cmd_dpc(un
  
        spin_lock_irqsave(&instance->completion_lock, flags);
  
 -      producer = *instance->producer;
 -      consumer = *instance->consumer;
 +      producer = le32_to_cpu(*instance->producer);
 +      consumer = le32_to_cpu(*instance->consumer);
  
        while (consumer != producer) {
 -              context = instance->reply_queue[consumer];
 +              context = le32_to_cpu(instance->reply_queue[consumer]);
                if (context >= instance->max_fw_cmds) {
                        printk(KERN_ERR "Unexpected context value %x\n",
                                context);
                }
        }
  
 -      *instance->consumer = producer;
 +      *instance->consumer = cpu_to_le32(producer);
  
        spin_unlock_irqrestore(&instance->completion_lock, flags);
  
@@@ -1741,7 -1716,7 +1741,7 @@@ void megasas_do_ocr(struct megasas_inst
        if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1064R) ||
        (instance->pdev->device == PCI_DEVICE_ID_DELL_PERC5) ||
        (instance->pdev->device == PCI_DEVICE_ID_LSI_VERDE_ZCR)) {
 -              *instance->consumer     = MEGASAS_ADPRESET_INPROG_SIGN;
 +              *instance->consumer = cpu_to_le32(MEGASAS_ADPRESET_INPROG_SIGN);
        }
        instance->instancet->disable_intr(instance);
        instance->adprecovery   = MEGASAS_ADPRESET_SM_INFAULT;
@@@ -2211,7 -2186,6 +2211,7 @@@ megasas_complete_cmd(struct megasas_ins
        struct megasas_header *hdr = &cmd->frame->hdr;
        unsigned long flags;
        struct fusion_context *fusion = instance->ctrl_context;
 +      u32 opcode;
  
        /* flag for the retry reset */
        cmd->retry_for_fw_reset = 0;
        case MFI_CMD_SMP:
        case MFI_CMD_STP:
        case MFI_CMD_DCMD:
 +              opcode = le32_to_cpu(cmd->frame->dcmd.opcode);
                /* Check for LD map update */
 -              if ((cmd->frame->dcmd.opcode == MR_DCMD_LD_MAP_GET_INFO) &&
 -                  (cmd->frame->dcmd.mbox.b[1] == 1)) {
 +              if ((opcode == MR_DCMD_LD_MAP_GET_INFO)
 +                      && (cmd->frame->dcmd.mbox.b[1] == 1)) {
                        fusion->fast_path_io = 0;
                        spin_lock_irqsave(instance->host->host_lock, flags);
                        if (cmd->frame->hdr.cmd_status != 0) {
                                               flags);
                        break;
                }
 -              if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET_INFO ||
 -                      cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_GET) {
 +              if (opcode == MR_DCMD_CTRL_EVENT_GET_INFO ||
 +                  opcode == MR_DCMD_CTRL_EVENT_GET) {
                        spin_lock_irqsave(&poll_aen_lock, flags);
                        megasas_poll_wait_aen = 0;
                        spin_unlock_irqrestore(&poll_aen_lock, flags);
                /*
                 * See if got an event notification
                 */
 -              if (cmd->frame->dcmd.opcode == MR_DCMD_CTRL_EVENT_WAIT)
 +              if (opcode == MR_DCMD_CTRL_EVENT_WAIT)
                        megasas_service_aen(instance, cmd);
                else
                        megasas_complete_int_cmd(instance, cmd);
@@@ -2633,7 -2606,7 +2633,7 @@@ megasas_deplete_reply_queue(struct mega
                                        PCI_DEVICE_ID_LSI_VERDE_ZCR)) {
  
                                *instance->consumer =
 -                                      MEGASAS_ADPRESET_INPROG_SIGN;
 +                                      cpu_to_le32(MEGASAS_ADPRESET_INPROG_SIGN);
                        }
  
  
@@@ -3010,7 -2983,7 +3010,7 @@@ static int megasas_create_frame_pool(st
                }
  
                memset(cmd->frame, 0, total_sz);
 -              cmd->frame->io.context = cmd->index;
 +              cmd->frame->io.context = cpu_to_le32(cmd->index);
                cmd->frame->io.pad_0 = 0;
                if ((instance->pdev->device != PCI_DEVICE_ID_LSI_FUSION) &&
                    (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) &&
@@@ -3170,13 -3143,13 +3170,13 @@@ megasas_get_pd_list(struct megasas_inst
        dcmd->cmd = MFI_CMD_DCMD;
        dcmd->cmd_status = 0xFF;
        dcmd->sge_count = 1;
 -      dcmd->flags = MFI_FRAME_DIR_READ;
 +      dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_READ);
        dcmd->timeout = 0;
        dcmd->pad_0 = 0;
 -      dcmd->data_xfer_len = MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST);
 -      dcmd->opcode = MR_DCMD_PD_LIST_QUERY;
 -      dcmd->sgl.sge32[0].phys_addr = ci_h;
 -      dcmd->sgl.sge32[0].length = MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST);
 +      dcmd->data_xfer_len = cpu_to_le32(MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST));
 +      dcmd->opcode = cpu_to_le32(MR_DCMD_PD_LIST_QUERY);
 +      dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(ci_h);
 +      dcmd->sgl.sge32[0].length = cpu_to_le32(MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST));
  
        if (!megasas_issue_polled(instance, cmd)) {
                ret = 0;
        pd_addr = ci->addr;
  
        if ( ret == 0 &&
 -              (ci->count <
 +           (le32_to_cpu(ci->count) <
                  (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) {
  
                memset(instance->pd_list, 0,
                        MEGASAS_MAX_PD * sizeof(struct megasas_pd_list));
  
 -              for (pd_index = 0; pd_index < ci->count; pd_index++) {
 +              for (pd_index = 0; pd_index < le32_to_cpu(ci->count); pd_index++) {
  
                        instance->pd_list[pd_addr->deviceId].tid        =
 -                                                      pd_addr->deviceId;
 +                              le16_to_cpu(pd_addr->deviceId);
                        instance->pd_list[pd_addr->deviceId].driveType  =
                                                        pd_addr->scsiDevType;
                        instance->pd_list[pd_addr->deviceId].driveState =
@@@ -3234,7 -3207,6 +3234,7 @@@ megasas_get_ld_list(struct megasas_inst
        struct megasas_dcmd_frame *dcmd;
        struct MR_LD_LIST *ci;
        dma_addr_t ci_h = 0;
 +      u32 ld_count;
  
        cmd = megasas_get_cmd(instance);
  
        dcmd->cmd = MFI_CMD_DCMD;
        dcmd->cmd_status = 0xFF;
        dcmd->sge_count = 1;
 -      dcmd->flags = MFI_FRAME_DIR_READ;
 +      dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_READ);
        dcmd->timeout = 0;
 -      dcmd->data_xfer_len = sizeof(struct MR_LD_LIST);
 -      dcmd->opcode = MR_DCMD_LD_GET_LIST;
 -      dcmd->sgl.sge32[0].phys_addr = ci_h;
 -      dcmd->sgl.sge32[0].length = sizeof(struct MR_LD_LIST);
 +      dcmd->data_xfer_len = cpu_to_le32(sizeof(struct MR_LD_LIST));
 +      dcmd->opcode = cpu_to_le32(MR_DCMD_LD_GET_LIST);
 +      dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(ci_h);
 +      dcmd->sgl.sge32[0].length = cpu_to_le32(sizeof(struct MR_LD_LIST));
        dcmd->pad_0  = 0;
  
        if (!megasas_issue_polled(instance, cmd)) {
                ret = -1;
        }
  
 +      ld_count = le32_to_cpu(ci->ldCount);
 +
        /* the following function will get the instance PD LIST */
  
 -      if ((ret == 0) && (ci->ldCount <= MAX_LOGICAL_DRIVES)) {
 +      if ((ret == 0) && (ld_count <= MAX_LOGICAL_DRIVES)) {
                memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
  
 -              for (ld_index = 0; ld_index < ci->ldCount; ld_index++) {
 +              for (ld_index = 0; ld_index < ld_count; ld_index++) {
                        if (ci->ldList[ld_index].state != 0) {
                                ids = ci->ldList[ld_index].ref.targetId;
                                instance->ld_ids[ids] =
        return ret;
  }
  
 +/**
 + * megasas_ld_list_query -    Returns FW's ld_list structure
 + * @instance:                         Adapter soft state
 + * @ld_list:                          ld_list structure
 + *
 + * Issues an internal command (DCMD) to get the FW's controller PD
 + * list structure.  This information is mainly used to find out SYSTEM
 + * supported by the FW.
 + */
 +static int
 +megasas_ld_list_query(struct megasas_instance *instance, u8 query_type)
 +{
 +      int ret = 0, ld_index = 0, ids = 0;
 +      struct megasas_cmd *cmd;
 +      struct megasas_dcmd_frame *dcmd;
 +      struct MR_LD_TARGETID_LIST *ci;
 +      dma_addr_t ci_h = 0;
 +      u32 tgtid_count;
 +
 +      cmd = megasas_get_cmd(instance);
 +
 +      if (!cmd) {
 +              printk(KERN_WARNING
 +                     "megasas:(megasas_ld_list_query): Failed to get cmd\n");
 +              return -ENOMEM;
 +      }
 +
 +      dcmd = &cmd->frame->dcmd;
 +
 +      ci = pci_alloc_consistent(instance->pdev,
 +                                sizeof(struct MR_LD_TARGETID_LIST), &ci_h);
 +
 +      if (!ci) {
 +              printk(KERN_WARNING
 +                     "megasas: Failed to alloc mem for ld_list_query\n");
 +              megasas_return_cmd(instance, cmd);
 +              return -ENOMEM;
 +      }
 +
 +      memset(ci, 0, sizeof(*ci));
 +      memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE);
 +
 +      dcmd->mbox.b[0] = query_type;
 +
 +      dcmd->cmd = MFI_CMD_DCMD;
 +      dcmd->cmd_status = 0xFF;
 +      dcmd->sge_count = 1;
 +      dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_READ);
 +      dcmd->timeout = 0;
 +      dcmd->data_xfer_len = cpu_to_le32(sizeof(struct MR_LD_TARGETID_LIST));
 +      dcmd->opcode = cpu_to_le32(MR_DCMD_LD_LIST_QUERY);
 +      dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(ci_h);
 +      dcmd->sgl.sge32[0].length = cpu_to_le32(sizeof(struct MR_LD_TARGETID_LIST));
 +      dcmd->pad_0  = 0;
 +
 +      if (!megasas_issue_polled(instance, cmd) && !dcmd->cmd_status) {
 +              ret = 0;
 +      } else {
 +              /* On failure, call older LD list DCMD */
 +              ret = 1;
 +      }
 +
 +      tgtid_count = le32_to_cpu(ci->count);
 +
 +      if ((ret == 0) && (tgtid_count <= (MAX_LOGICAL_DRIVES))) {
 +              memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
 +              for (ld_index = 0; ld_index < tgtid_count; ld_index++) {
 +                      ids = ci->targetId[ld_index];
 +                      instance->ld_ids[ids] = ci->targetId[ld_index];
 +              }
 +
 +      }
 +
 +      pci_free_consistent(instance->pdev, sizeof(struct MR_LD_TARGETID_LIST),
 +                          ci, ci_h);
 +
 +      megasas_return_cmd(instance, cmd);
 +
 +      return ret;
 +}
 +
  /**
   * megasas_get_controller_info -      Returns FW's controller structure
   * @instance:                         Adapter soft state
@@@ -3424,13 -3313,13 +3424,13 @@@ megasas_get_ctrl_info(struct megasas_in
        dcmd->cmd = MFI_CMD_DCMD;
        dcmd->cmd_status = 0xFF;
        dcmd->sge_count = 1;
 -      dcmd->flags = MFI_FRAME_DIR_READ;
 +      dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_READ);
        dcmd->timeout = 0;
        dcmd->pad_0 = 0;
 -      dcmd->data_xfer_len = sizeof(struct megasas_ctrl_info);
 -      dcmd->opcode = MR_DCMD_CTRL_GET_INFO;
 -      dcmd->sgl.sge32[0].phys_addr = ci_h;
 -      dcmd->sgl.sge32[0].length = sizeof(struct megasas_ctrl_info);
 +      dcmd->data_xfer_len = cpu_to_le32(sizeof(struct megasas_ctrl_info));
 +      dcmd->opcode = cpu_to_le32(MR_DCMD_CTRL_GET_INFO);
 +      dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(ci_h);
 +      dcmd->sgl.sge32[0].length = cpu_to_le32(sizeof(struct megasas_ctrl_info));
  
        if (!megasas_issue_polled(instance, cmd)) {
                ret = 0;
@@@ -3486,20 -3375,17 +3486,20 @@@ megasas_issue_init_mfi(struct megasas_i
        memset(initq_info, 0, sizeof(struct megasas_init_queue_info));
        init_frame->context = context;
  
 -      initq_info->reply_queue_entries = instance->max_fw_cmds + 1;
 -      initq_info->reply_queue_start_phys_addr_lo = instance->reply_queue_h;
 +      initq_info->reply_queue_entries = cpu_to_le32(instance->max_fw_cmds + 1);
 +      initq_info->reply_queue_start_phys_addr_lo = cpu_to_le32(instance->reply_queue_h);
  
 -      initq_info->producer_index_phys_addr_lo = instance->producer_h;
 -      initq_info->consumer_index_phys_addr_lo = instance->consumer_h;
 +      initq_info->producer_index_phys_addr_lo = cpu_to_le32(instance->producer_h);
 +      initq_info->consumer_index_phys_addr_lo = cpu_to_le32(instance->consumer_h);
  
        init_frame->cmd = MFI_CMD_INIT;
        init_frame->cmd_status = 0xFF;
 -      init_frame->queue_info_new_phys_addr_lo = initq_info_h;
 +      init_frame->queue_info_new_phys_addr_lo =
 +              cpu_to_le32(lower_32_bits(initq_info_h));
 +      init_frame->queue_info_new_phys_addr_hi =
 +              cpu_to_le32(upper_32_bits(initq_info_h));
  
 -      init_frame->data_xfer_len = sizeof(struct megasas_init_queue_info);
 +      init_frame->data_xfer_len = cpu_to_le32(sizeof(struct megasas_init_queue_info));
  
        /*
         * disable the intr before firing the init frame to FW
@@@ -3762,9 -3648,7 +3762,9 @@@ static int megasas_init_fw(struct megas
        megasas_get_pd_list(instance);
  
        memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
 -      megasas_get_ld_list(instance);
 +      if (megasas_ld_list_query(instance,
 +                                MR_LD_QUERY_TYPE_EXPOSED_TO_HOST))
 +              megasas_get_ld_list(instance);
  
        ctrl_info = kmalloc(sizeof(struct megasas_ctrl_info), GFP_KERNEL);
  
        if (ctrl_info && !megasas_get_ctrl_info(instance, ctrl_info)) {
  
                max_sectors_1 = (1 << ctrl_info->stripe_sz_ops.min) *
 -                  ctrl_info->max_strips_per_io;
 -              max_sectors_2 = ctrl_info->max_request_size;
 +                      le16_to_cpu(ctrl_info->max_strips_per_io);
 +              max_sectors_2 = le32_to_cpu(ctrl_info->max_request_size);
  
                tmp_sectors = min_t(u32, max_sectors_1 , max_sectors_2);
  
                        instance->is_imr = 0;
                        dev_info(&instance->pdev->dev, "Controller type: MR,"
                                "Memory size is: %dMB\n",
 -                              ctrl_info->memory_size);
 +                              le16_to_cpu(ctrl_info->memory_size));
                } else {
                        instance->is_imr = 1;
                        dev_info(&instance->pdev->dev,
                                "Controller type: iMR\n");
                }
 +              /* OnOffProperties are converted into CPU arch*/
 +              le32_to_cpus((u32 *)&ctrl_info->properties.OnOffProperties);
                instance->disableOnlineCtrlReset =
                ctrl_info->properties.OnOffProperties.disableOnlineCtrlReset;
 +              /* adapterOperations2 are converted into CPU arch*/
 +              le32_to_cpus((u32 *)&ctrl_info->adapterOperations2);
                instance->UnevenSpanSupport =
                        ctrl_info->adapterOperations2.supportUnevenSpans;
                if (instance->UnevenSpanSupport) {
  
                }
        }
 -
        instance->max_sectors_per_req = instance->max_num_sge *
                                                PAGE_SIZE / 512;
        if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors))
@@@ -3921,24 -3802,20 +3921,24 @@@ megasas_get_seq_num(struct megasas_inst
        dcmd->cmd = MFI_CMD_DCMD;
        dcmd->cmd_status = 0x0;
        dcmd->sge_count = 1;
 -      dcmd->flags = MFI_FRAME_DIR_READ;
 +      dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_READ);
        dcmd->timeout = 0;
        dcmd->pad_0 = 0;
 -      dcmd->data_xfer_len = sizeof(struct megasas_evt_log_info);
 -      dcmd->opcode = MR_DCMD_CTRL_EVENT_GET_INFO;
 -      dcmd->sgl.sge32[0].phys_addr = el_info_h;
 -      dcmd->sgl.sge32[0].length = sizeof(struct megasas_evt_log_info);
 +      dcmd->data_xfer_len = cpu_to_le32(sizeof(struct megasas_evt_log_info));
 +      dcmd->opcode = cpu_to_le32(MR_DCMD_CTRL_EVENT_GET_INFO);
 +      dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(el_info_h);
 +      dcmd->sgl.sge32[0].length = cpu_to_le32(sizeof(struct megasas_evt_log_info));
  
        megasas_issue_blocked_cmd(instance, cmd);
  
        /*
         * Copy the data back into callers buffer
         */
 -      memcpy(eli, el_info, sizeof(struct megasas_evt_log_info));
 +      eli->newest_seq_num = le32_to_cpu(el_info->newest_seq_num);
 +      eli->oldest_seq_num = le32_to_cpu(el_info->oldest_seq_num);
 +      eli->clear_seq_num = le32_to_cpu(el_info->clear_seq_num);
 +      eli->shutdown_seq_num = le32_to_cpu(el_info->shutdown_seq_num);
 +      eli->boot_seq_num = le32_to_cpu(el_info->boot_seq_num);
  
        pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info),
                            el_info, el_info_h);
@@@ -3985,7 -3862,6 +3985,7 @@@ megasas_register_aen(struct megasas_ins
        if (instance->aen_cmd) {
  
                prev_aen.word = instance->aen_cmd->frame->dcmd.mbox.w[1];
 +              prev_aen.members.locale = le16_to_cpu(prev_aen.members.locale);
  
                /*
                 * A class whose enum value is smaller is inclusive of all
                 * values
                 */
                if ((prev_aen.members.class <= curr_aen.members.class) &&
 -                  !((prev_aen.members.locale & curr_aen.members.locale) ^
 +                  !((le16_to_cpu(prev_aen.members.locale) & curr_aen.members.locale) ^
                      curr_aen.members.locale)) {
                        /*
                         * Previously issued event registration includes
                         */
                        return 0;
                } else {
 -                      curr_aen.members.locale |= prev_aen.members.locale;
 +                      curr_aen.members.locale |= le16_to_cpu(prev_aen.members.locale);
  
                        if (prev_aen.members.class < curr_aen.members.class)
                                curr_aen.members.class = prev_aen.members.class;
        dcmd->cmd = MFI_CMD_DCMD;
        dcmd->cmd_status = 0x0;
        dcmd->sge_count = 1;
 -      dcmd->flags = MFI_FRAME_DIR_READ;
 +      dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_READ);
        dcmd->timeout = 0;
        dcmd->pad_0 = 0;
 +      dcmd->data_xfer_len = cpu_to_le32(sizeof(struct megasas_evt_detail));
 +      dcmd->opcode = cpu_to_le32(MR_DCMD_CTRL_EVENT_WAIT);
 +      dcmd->mbox.w[0] = cpu_to_le32(seq_num);
        instance->last_seq_num = seq_num;
 -      dcmd->data_xfer_len = sizeof(struct megasas_evt_detail);
 -      dcmd->opcode = MR_DCMD_CTRL_EVENT_WAIT;
 -      dcmd->mbox.w[0] = seq_num;
 -      dcmd->mbox.w[1] = curr_aen.word;
 -      dcmd->sgl.sge32[0].phys_addr = (u32) instance->evt_detail_h;
 -      dcmd->sgl.sge32[0].length = sizeof(struct megasas_evt_detail);
 +      dcmd->mbox.w[1] = cpu_to_le32(curr_aen.word);
 +      dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(instance->evt_detail_h);
 +      dcmd->sgl.sge32[0].length = cpu_to_le32(sizeof(struct megasas_evt_detail));
  
        if (instance->aen_cmd != NULL) {
                megasas_return_cmd(instance, cmd);
@@@ -4096,9 -3972,8 +4096,9 @@@ static int megasas_start_aen(struct meg
        class_locale.members.locale = MR_EVT_LOCALE_ALL;
        class_locale.members.class = MR_EVT_CLASS_DEBUG;
  
 -      return megasas_register_aen(instance, eli.newest_seq_num + 1,
 -                                  class_locale.word);
 +      return megasas_register_aen(instance,
 +                      le32_to_cpu(eli.newest_seq_num) + 1,
 +                      class_locale.word);
  }
  
  /**
@@@ -4193,7 -4068,6 +4193,7 @@@ megasas_set_dma_mask(struct pci_dev *pd
                if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)
                        goto fail_set_dma_mask;
        }
 +
        return 0;
  
  fail_set_dma_mask:
@@@ -4449,7 -4323,6 +4449,6 @@@ retry_irq_register
        megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
        megasas_mgmt_info.max_index--;
  
-       pci_set_drvdata(pdev, NULL);
        instance->instancet->disable_intr(instance);
        if (instance->msix_vectors)
                for (i = 0 ; i < instance->msix_vectors; i++)
@@@ -4512,11 -4385,11 +4511,11 @@@ static void megasas_flush_cache(struct 
        dcmd->cmd = MFI_CMD_DCMD;
        dcmd->cmd_status = 0x0;
        dcmd->sge_count = 0;
 -      dcmd->flags = MFI_FRAME_DIR_NONE;
 +      dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_NONE);
        dcmd->timeout = 0;
        dcmd->pad_0 = 0;
        dcmd->data_xfer_len = 0;
 -      dcmd->opcode = MR_DCMD_CTRL_CACHE_FLUSH;
 +      dcmd->opcode = cpu_to_le32(MR_DCMD_CTRL_CACHE_FLUSH);
        dcmd->mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
  
        megasas_issue_blocked_cmd(instance, cmd);
@@@ -4557,11 -4430,11 +4556,11 @@@ static void megasas_shutdown_controller
        dcmd->cmd = MFI_CMD_DCMD;
        dcmd->cmd_status = 0x0;
        dcmd->sge_count = 0;
 -      dcmd->flags = MFI_FRAME_DIR_NONE;
 +      dcmd->flags = cpu_to_le16(MFI_FRAME_DIR_NONE);
        dcmd->timeout = 0;
        dcmd->pad_0 = 0;
        dcmd->data_xfer_len = 0;
 -      dcmd->opcode = opcode;
 +      dcmd->opcode = cpu_to_le32(opcode);
  
        megasas_issue_blocked_cmd(instance, cmd);
  
@@@ -4805,8 -4678,6 +4804,6 @@@ static void megasas_detach_one(struct p
                }
        }
  
-       pci_set_drvdata(instance->pdev, NULL);
        instance->instancet->disable_intr(instance);
  
        if (instance->msix_vectors)
                                instance->evt_detail, instance->evt_detail_h);
        scsi_host_put(host);
  
-       pci_set_drvdata(pdev, NULL);
        pci_disable_device(pdev);
  
        return;
@@@ -4976,11 -4845,10 +4971,11 @@@ megasas_mgmt_fw_ioctl(struct megasas_in
         * alone separately
         */
        memcpy(cmd->frame, ioc->frame.raw, 2 * MEGAMFI_FRAME_SIZE);
 -      cmd->frame->hdr.context = cmd->index;
 +      cmd->frame->hdr.context = cpu_to_le32(cmd->index);
        cmd->frame->hdr.pad_0 = 0;
 -      cmd->frame->hdr.flags &= ~(MFI_FRAME_IEEE | MFI_FRAME_SGL64 |
 -                                 MFI_FRAME_SENSE64);
 +      cmd->frame->hdr.flags &= cpu_to_le16(~(MFI_FRAME_IEEE |
 +                                             MFI_FRAME_SGL64 |
 +                                             MFI_FRAME_SENSE64));
  
        /*
         * The management interface between applications and the fw uses
                 * We don't change the dma_coherent_mask, so
                 * pci_alloc_consistent only returns 32bit addresses
                 */
 -              kern_sge32[i].phys_addr = (u32) buf_handle;
 -              kern_sge32[i].length = ioc->sgl[i].iov_len;
 +              kern_sge32[i].phys_addr = cpu_to_le32(buf_handle);
 +              kern_sge32[i].length = cpu_to_le32(ioc->sgl[i].iov_len);
  
                /*
                 * We created a kernel buffer corresponding to the
  
                sense_ptr =
                (unsigned long *) ((unsigned long)cmd->frame + ioc->sense_off);
 -              *sense_ptr = sense_handle;
 +              *sense_ptr = cpu_to_le32(sense_handle);
        }
  
        /*
        for (i = 0; i < ioc->sge_count; i++) {
                if (kbuff_arr[i])
                        dma_free_coherent(&instance->pdev->dev,
 -                                        kern_sge32[i].length,
 +                                        le32_to_cpu(kern_sge32[i].length),
                                          kbuff_arr[i],
 -                                        kern_sge32[i].phys_addr);
 +                                        le32_to_cpu(kern_sge32[i].phys_addr));
        }
  
        megasas_return_cmd(instance, cmd);
@@@ -5454,7 -5322,7 +5449,7 @@@ megasas_aen_polling(struct work_struct 
        host = instance->host;
        if (instance->evt_detail) {
  
 -              switch (instance->evt_detail->code) {
 +              switch (le32_to_cpu(instance->evt_detail->code)) {
                case MR_EVT_PD_INSERTED:
                        if (megasas_get_pd_list(instance) == 0) {
                        for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) {
                case MR_EVT_LD_OFFLINE:
                case MR_EVT_CFG_CLEARED:
                case MR_EVT_LD_DELETED:
 -                      megasas_get_ld_list(instance);
 +                      if (megasas_ld_list_query(instance,
 +                                      MR_LD_QUERY_TYPE_EXPOSED_TO_HOST))
 +                              megasas_get_ld_list(instance);
                        for (i = 0; i < MEGASAS_MAX_LD_CHANNELS; i++) {
                                for (j = 0;
                                j < MEGASAS_MAX_DEV_PER_CHANNEL;
                                (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
  
                                sdev1 = scsi_device_lookup(host,
 -                                      i + MEGASAS_MAX_LD_CHANNELS,
 +                                      MEGASAS_MAX_PD_CHANNELS + i,
                                        j,
                                        0);
  
                        doscan = 0;
                        break;
                case MR_EVT_LD_CREATED:
 -                      megasas_get_ld_list(instance);
 +                      if (megasas_ld_list_query(instance,
 +                                      MR_LD_QUERY_TYPE_EXPOSED_TO_HOST))
 +                              megasas_get_ld_list(instance);
                        for (i = 0; i < MEGASAS_MAX_LD_CHANNELS; i++) {
                                for (j = 0;
                                        j < MEGASAS_MAX_DEV_PER_CHANNEL;
                                        (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
  
                                        sdev1 = scsi_device_lookup(host,
 -                                              i+MEGASAS_MAX_LD_CHANNELS,
 +                                              MEGASAS_MAX_PD_CHANNELS + i,
                                                j, 0);
  
                                        if (instance->ld_ids[ld_index] !=
                                                                0xff) {
                                                if (!sdev1) {
                                                        scsi_add_device(host,
 -                                                              i + 2,
 +                                              MEGASAS_MAX_PD_CHANNELS + i,
                                                                j, 0);
                                                }
                                        }
                        }
                }
  
 -              megasas_get_ld_list(instance);
 +              if (megasas_ld_list_query(instance,
 +                                        MR_LD_QUERY_TYPE_EXPOSED_TO_HOST))
 +                      megasas_get_ld_list(instance);
                for (i = 0; i < MEGASAS_MAX_LD_CHANNELS; i++) {
                        for (j = 0; j < MEGASAS_MAX_DEV_PER_CHANNEL; j++) {
                                ld_index =
                                (i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
  
                                sdev1 = scsi_device_lookup(host,
 -                                      i+MEGASAS_MAX_LD_CHANNELS, j, 0);
 +                                      MEGASAS_MAX_PD_CHANNELS + i, j, 0);
                                if (instance->ld_ids[ld_index] != 0xff) {
                                        if (!sdev1) {
                                                scsi_add_device(host,
 -                                                              i+2,
 +                                              MEGASAS_MAX_PD_CHANNELS + i,
                                                                j, 0);
                                        } else {
                                                scsi_device_put(sdev1);
                return ;
        }
  
 -      seq_num = instance->evt_detail->seq_num + 1;
 +      seq_num = le32_to_cpu(instance->evt_detail->seq_num) + 1;
  
        /* Register AEN with FW for latest sequence number plus 1 */
        class_locale.members.reserved = 0;
index bcd57f699ebbcc7dad7d597044c7bc54da22cf52,1db4819261cd802f75c6b7a50b523540006b4fe0..52be35e0300c901ac18faff6ded2aaf65e43b675
@@@ -494,14 -494,18 +494,14 @@@ qla24xx_pci_info_str(struct scsi_qla_ho
        static char *pci_bus_modes[] = { "33", "66", "100", "133", };
        struct qla_hw_data *ha = vha->hw;
        uint32_t pci_bus;
 -      int pcie_reg;
  
 -      pcie_reg = pci_pcie_cap(ha->pdev);
 -      if (pcie_reg) {
 +      if (pci_is_pcie(ha->pdev)) {
                char lwstr[6];
 -              uint16_t pcie_lstat, lspeed, lwidth;
 +              uint32_t lstat, lspeed, lwidth;
  
 -              pcie_reg += PCI_EXP_LNKCAP;
 -              pci_read_config_word(ha->pdev, pcie_reg, &pcie_lstat);
 -              lspeed = pcie_lstat & (BIT_0 | BIT_1 | BIT_2 | BIT_3);
 -              lwidth = (pcie_lstat &
 -                  (BIT_4 | BIT_5 | BIT_6 | BIT_7 | BIT_8 | BIT_9)) >> 4;
 +              pcie_capability_read_dword(ha->pdev, PCI_EXP_LNKCAP, &lstat);
 +              lspeed = lstat & PCI_EXP_LNKCAP_SLS;
 +              lwidth = (lstat & PCI_EXP_LNKCAP_MLW) >> 4;
  
                strcpy(str, "PCIe (");
                switch (lspeed) {
@@@ -3179,7 -3183,6 +3179,6 @@@ qla2x00_remove_one(struct pci_dev *pdev
        pci_disable_pcie_error_reporting(pdev);
  
        pci_disable_device(pdev);
-       pci_set_drvdata(pdev, NULL);
  }
  
  static void
diff --combined fs/btrfs/Kconfig
index 398cbd517be218bbfc155f06e1bec5e5fe71717c,e374bf96a4427ce622b17cff2b2616d0394c099a..f9d5094e102943db81708451a43312f6ac2e9525
@@@ -59,7 -59,8 +59,8 @@@ config BTRFS_FS_RUN_SANITY_TEST
        help
          This will run some basic sanity tests on the free space cache
          code to make sure it is acting as it should.  These are mostly
-         regression tests and are only really interesting to btrfs devlopers.
+         regression tests and are only really interesting to btrfs
+         developers.
  
          If unsure, say N.
  
@@@ -72,12 -73,3 +73,12 @@@ config BTRFS_DEBU
          performance, or export extra information via sysfs.
  
          If unsure, say N.
 +
 +config BTRFS_ASSERT
 +      bool "Btrfs assert support"
 +      depends on BTRFS_FS
 +      help
 +        Enable run-time assertion checking.  This will result in panics if
 +        any of the assertions trip.  This is meant for btrfs developers only.
 +
 +        If unsure, say N.
diff --combined include/linux/devfreq.h
index 7a7cc74d7f27e9901e59d2a61b850c0ec6acbe9e,32acc0090ce60d13e688f9f9146b3c56d51e750d..d48dc00232a436cbf67b577b54a8bd27336a161c
@@@ -15,7 -15,7 +15,7 @@@
  
  #include <linux/device.h>
  #include <linux/notifier.h>
 -#include <linux/opp.h>
 +#include <linux/pm_opp.h>
  
  #define DEVFREQ_NAME_LEN 16
  
@@@ -168,7 -168,7 +168,7 @@@ struct devfreq 
        unsigned long max_freq;
        bool stop_polling;
  
-       /* information for device freqeuncy transition */
+       /* information for device frequency transition */
        unsigned int total_trans;
        unsigned int *trans_table;
        unsigned long *time_in_state;
@@@ -187,7 -187,7 +187,7 @@@ extern int devfreq_suspend_device(struc
  extern int devfreq_resume_device(struct devfreq *devfreq);
  
  /* Helper functions for devfreq user device driver with OPP. */
 -extern struct opp *devfreq_recommended_opp(struct device *dev,
 +extern struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
                                           unsigned long *freq, u32 flags);
  extern int devfreq_register_opp_notifier(struct device *dev,
                                         struct devfreq *devfreq);
@@@ -238,7 -238,7 +238,7 @@@ static inline int devfreq_resume_device
        return 0;
  }
  
 -static inline struct opp *devfreq_recommended_opp(struct device *dev,
 +static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
                                           unsigned long *freq, u32 flags)
  {
        return ERR_PTR(-EINVAL);
index 27f62f746621a8758b7beb60b8b530604aa0fb74,9ff50c9a000935d9f0276a891fb310df0b5ec3d9..c893f2295f496ffb7785b24ad27f4123e41251cb
@@@ -60,8 -60,8 +60,8 @@@ struct wireless_dev
  #define SET_ETHTOOL_OPS(netdev,ops) \
        ( (netdev)->ethtool_ops = (ops) )
  
 -extern void netdev_set_default_ethtool_ops(struct net_device *dev,
 -                                         const struct ethtool_ops *ops);
 +void netdev_set_default_ethtool_ops(struct net_device *dev,
 +                                  const struct ethtool_ops *ops);
  
  /* hardware address assignment types */
  #define NET_ADDR_PERM         0       /* address is permanent (default) */
@@@ -298,7 -298,7 +298,7 @@@ struct netdev_boot_setup 
  };
  #define NETDEV_BOOT_SETUP_MAX 8
  
 -extern int __init netdev_boot_setup(char *str);
 +int __init netdev_boot_setup(char *str);
  
  /*
   * Structure for NAPI scheduling similar to tasklet but with weighting
@@@ -394,7 -394,7 +394,7 @@@ enum rx_handler_result 
  typedef enum rx_handler_result rx_handler_result_t;
  typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
  
 -extern void __napi_schedule(struct napi_struct *n);
 +void __napi_schedule(struct napi_struct *n);
  
  static inline bool napi_disable_pending(struct napi_struct *n)
  {
@@@ -445,8 -445,8 +445,8 @@@ static inline bool napi_reschedule(stru
   *
   * Mark NAPI processing as complete.
   */
 -extern void __napi_complete(struct napi_struct *n);
 -extern void napi_complete(struct napi_struct *n);
 +void __napi_complete(struct napi_struct *n);
 +void napi_complete(struct napi_struct *n);
  
  /**
   *    napi_by_id - lookup a NAPI by napi_id
   * lookup @napi_id in napi_hash table
   * must be called under rcu_read_lock()
   */
 -extern struct napi_struct *napi_by_id(unsigned int napi_id);
 +struct napi_struct *napi_by_id(unsigned int napi_id);
  
  /**
   *    napi_hash_add - add a NAPI to global hashtable
   *
   * generate a new napi_id and store a @napi under it in napi_hash
   */
 -extern void napi_hash_add(struct napi_struct *napi);
 +void napi_hash_add(struct napi_struct *napi);
  
  /**
   *    napi_hash_del - remove a NAPI from global table
   * Warning: caller must observe rcu grace period
   * before freeing memory containing @napi
   */
 -extern void napi_hash_del(struct napi_struct *napi);
 +void napi_hash_del(struct napi_struct *napi);
  
  /**
   *    napi_disable - prevent NAPI from scheduling
@@@ -664,8 -664,8 +664,8 @@@ static inline void rps_reset_sock_flow(
  extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
  
  #ifdef CONFIG_RFS_ACCEL
 -extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index,
 -                              u32 flow_id, u16 filter_id);
 +bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
 +                       u16 filter_id);
  #endif
  
  /* This structure contains an instance of an RX queue. */
@@@ -950,14 -950,14 +950,14 @@@ struct netdev_phys_port_id 
   *    multiple net devices on single physical port.
   *
   * void (*ndo_add_vxlan_port)(struct  net_device *dev,
 - *                          sa_family_t sa_family, __u16 port);
 + *                          sa_family_t sa_family, __be16 port);
   *    Called by vxlan to notiy a driver about the UDP port and socket
   *    address family that vxlan is listnening to. It is called only when
   *    a new port starts listening. The operation is protected by the
   *    vxlan_net->sock_lock.
   *
   * void (*ndo_del_vxlan_port)(struct  net_device *dev,
 - *                          sa_family_t sa_family, __u16 port);
 + *                          sa_family_t sa_family, __be16 port);
   *    Called by vxlan to notify the driver about a UDP port and socket
   *    address family that vxlan is not listening to anymore. The operation
   *    is protected by the vxlan_net->sock_lock.
@@@ -1093,10 -1093,10 +1093,10 @@@ struct net_device_ops 
                                                        struct netdev_phys_port_id *ppid);
        void                    (*ndo_add_vxlan_port)(struct  net_device *dev,
                                                      sa_family_t sa_family,
 -                                                    __u16 port);
 +                                                    __be16 port);
        void                    (*ndo_del_vxlan_port)(struct  net_device *dev,
                                                      sa_family_t sa_family,
 -                                                    __u16 port);
 +                                                    __be16 port);
  };
  
  /*
@@@ -1143,19 -1143,8 +1143,19 @@@ struct net_device 
        struct list_head        dev_list;
        struct list_head        napi_list;
        struct list_head        unreg_list;
 -      struct list_head        upper_dev_list; /* List of upper devices */
 -      struct list_head        lower_dev_list;
 +      struct list_head        close_list;
 +
 +      /* directly linked devices, like slaves for bonding */
 +      struct {
 +              struct list_head upper;
 +              struct list_head lower;
 +      } adj_list;
 +
 +      /* all linked devices, *including* neighbours */
 +      struct {
 +              struct list_head upper;
 +              struct list_head lower;
 +      } all_adj_list;
  
  
        /* currently active device features */
@@@ -1498,9 -1487,9 +1498,9 @@@ static inline void netdev_for_each_tx_q
                f(dev, &dev->_tx[i], arg);
  }
  
 -extern struct netdev_queue *netdev_pick_tx(struct net_device *dev,
 -                                         struct sk_buff *skb);
 -extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
 +struct netdev_queue *netdev_pick_tx(struct net_device *dev,
 +                                  struct sk_buff *skb);
 +u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
  
  /*
   * Net namespace inlines
@@@ -1557,7 -1546,7 +1557,7 @@@ static inline void *netdev_priv(const s
  #define SET_NETDEV_DEV(net, pdev)     ((net)->dev.parent = (pdev))
  
  /* Set the sysfs device type for the network logical device to allow
-  * fin grained indentification of different network device types. For
+  * fine-grained identification of different network device types. For
   * example Ethernet, Wirelss LAN, Bluetooth, WiMAX etc.
   */
  #define SET_NETDEV_DEVTYPE(net, devtype)      ((net)->dev.type = (devtype))
@@@ -1684,8 -1673,8 +1684,8 @@@ struct packet_offload 
  #define NETDEV_CHANGEUPPER    0x0015
  #define NETDEV_RESEND_IGMP    0x0016
  
 -extern int register_netdevice_notifier(struct notifier_block *nb);
 -extern int unregister_netdevice_notifier(struct notifier_block *nb);
 +int register_netdevice_notifier(struct notifier_block *nb);
 +int unregister_netdevice_notifier(struct notifier_block *nb);
  
  struct netdev_notifier_info {
        struct net_device *dev;
@@@ -1708,9 -1697,9 +1708,9 @@@ netdev_notifier_info_to_dev(const struc
        return info->dev;
  }
  
 -extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
 -                                       struct netdev_notifier_info *info);
 -extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
 +int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
 +                                struct netdev_notifier_info *info);
 +int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
  
  
  extern rwlock_t                               dev_base_lock;          /* Device list lock */
@@@ -1765,52 -1754,54 +1765,52 @@@ static inline struct net_device *first_
        return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
  }
  
 -extern int                    netdev_boot_setup_check(struct net_device *dev);
 -extern unsigned long          netdev_boot_base(const char *prefix, int unit);
 -extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
 -                                            const char *hwaddr);
 -extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
 -extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
 -extern void           dev_add_pack(struct packet_type *pt);
 -extern void           dev_remove_pack(struct packet_type *pt);
 -extern void           __dev_remove_pack(struct packet_type *pt);
 -extern void           dev_add_offload(struct packet_offload *po);
 -extern void           dev_remove_offload(struct packet_offload *po);
 -extern void           __dev_remove_offload(struct packet_offload *po);
 -
 -extern struct net_device      *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
 -                                                    unsigned short mask);
 -extern struct net_device      *dev_get_by_name(struct net *net, const char *name);
 -extern struct net_device      *dev_get_by_name_rcu(struct net *net, const char *name);
 -extern struct net_device      *__dev_get_by_name(struct net *net, const char *name);
 -extern int            dev_alloc_name(struct net_device *dev, const char *name);
 -extern int            dev_open(struct net_device *dev);
 -extern int            dev_close(struct net_device *dev);
 -extern void           dev_disable_lro(struct net_device *dev);
 -extern int            dev_loopback_xmit(struct sk_buff *newskb);
 -extern int            dev_queue_xmit(struct sk_buff *skb);
 -extern int            register_netdevice(struct net_device *dev);
 -extern void           unregister_netdevice_queue(struct net_device *dev,
 -                                                 struct list_head *head);
 -extern void           unregister_netdevice_many(struct list_head *head);
 +int netdev_boot_setup_check(struct net_device *dev);
 +unsigned long netdev_boot_base(const char *prefix, int unit);
 +struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
 +                                     const char *hwaddr);
 +struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
 +struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
 +void dev_add_pack(struct packet_type *pt);
 +void dev_remove_pack(struct packet_type *pt);
 +void __dev_remove_pack(struct packet_type *pt);
 +void dev_add_offload(struct packet_offload *po);
 +void dev_remove_offload(struct packet_offload *po);
 +void __dev_remove_offload(struct packet_offload *po);
 +
 +struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
 +                                      unsigned short mask);
 +struct net_device *dev_get_by_name(struct net *net, const char *name);
 +struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
 +struct net_device *__dev_get_by_name(struct net *net, const char *name);
 +int dev_alloc_name(struct net_device *dev, const char *name);
 +int dev_open(struct net_device *dev);
 +int dev_close(struct net_device *dev);
 +void dev_disable_lro(struct net_device *dev);
 +int dev_loopback_xmit(struct sk_buff *newskb);
 +int dev_queue_xmit(struct sk_buff *skb);
 +int register_netdevice(struct net_device *dev);
 +void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
 +void unregister_netdevice_many(struct list_head *head);
  static inline void unregister_netdevice(struct net_device *dev)
  {
        unregister_netdevice_queue(dev, NULL);
  }
  
 -extern int            netdev_refcnt_read(const struct net_device *dev);
 -extern void           free_netdev(struct net_device *dev);
 -extern void           synchronize_net(void);
 -extern int            init_dummy_netdev(struct net_device *dev);
 +int netdev_refcnt_read(const struct net_device *dev);
 +void free_netdev(struct net_device *dev);
 +void synchronize_net(void);
 +int init_dummy_netdev(struct net_device *dev);
  
 -extern struct net_device      *dev_get_by_index(struct net *net, int ifindex);
 -extern struct net_device      *__dev_get_by_index(struct net *net, int ifindex);
 -extern struct net_device      *dev_get_by_index_rcu(struct net *net, int ifindex);
 -extern int            netdev_get_name(struct net *net, char *name, int ifindex);
 -extern int            dev_restart(struct net_device *dev);
 +struct net_device *dev_get_by_index(struct net *net, int ifindex);
 +struct net_device *__dev_get_by_index(struct net *net, int ifindex);
 +struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
 +int netdev_get_name(struct net *net, char *name, int ifindex);
 +int dev_restart(struct net_device *dev);
  #ifdef CONFIG_NETPOLL_TRAP
 -extern int            netpoll_trap(void);
 +int netpoll_trap(void);
  #endif
 -extern int           skb_gro_receive(struct sk_buff **head,
 -                                     struct sk_buff *skb);
 +int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
  
  static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
  {
@@@ -1882,7 -1873,7 +1882,7 @@@ static inline int dev_parse_header(cons
  }
  
  typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
 -extern int            register_gifconf(unsigned int family, gifconf_func_t * gifconf);
 +int register_gifconf(unsigned int family, gifconf_func_t *gifconf);
  static inline int unregister_gifconf(unsigned int family)
  {
        return register_gifconf(family, NULL);
@@@ -1953,7 -1944,7 +1953,7 @@@ static inline void input_queue_tail_inc
  
  DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
  
 -extern void __netif_schedule(struct Qdisc *q);
 +void __netif_schedule(struct Qdisc *q);
  
  static inline void netif_schedule_queue(struct netdev_queue *txq)
  {
@@@ -2110,15 -2101,6 +2110,15 @@@ static inline void netdev_tx_sent_queue
  #endif
  }
  
 +/**
 + *    netdev_sent_queue - report the number of bytes queued to hardware
 + *    @dev: network device
 + *    @bytes: number of bytes queued to the hardware device queue
 + *
 + *    Report the number of bytes queued for sending/completion to the network
 + *    device hardware queue. @bytes should be a good approximation and should
 + *    exactly match netdev_completed_queue() @bytes
 + */
  static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
  {
        netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes);
@@@ -2148,16 -2130,6 +2148,16 @@@ static inline void netdev_tx_completed_
  #endif
  }
  
 +/**
 + *    netdev_completed_queue - report bytes and packets completed by device
 + *    @dev: network device
 + *    @pkts: actual number of packets sent over the medium
 + *    @bytes: actual number of bytes sent over the medium
 + *
 + *    Report the number of bytes and packets transmitted by the network device
 + *    hardware queue over the physical medium, @bytes must exactly match the
 + *    @bytes amount passed to netdev_sent_queue()
 + */
  static inline void netdev_completed_queue(struct net_device *dev,
                                          unsigned int pkts, unsigned int bytes)
  {
@@@ -2172,13 -2144,6 +2172,13 @@@ static inline void netdev_tx_reset_queu
  #endif
  }
  
 +/**
 + *    netdev_reset_queue - reset the packets and bytes count of a network device
 + *    @dev_queue: network device
 + *
 + *    Reset the bytes and packet count of a network device and clear the
 + *    software flow control OFF bit for this network device
 + */
  static inline void netdev_reset_queue(struct net_device *dev_queue)
  {
        netdev_tx_reset_queue(netdev_get_tx_queue(dev_queue, 0));
@@@ -2273,11 -2238,11 +2273,11 @@@ static inline void netif_wake_subqueue(
  }
  
  #ifdef CONFIG_XPS
 -extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask,
 -                             u16 index);
 +int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
 +                      u16 index);
  #else
  static inline int netif_set_xps_queue(struct net_device *dev,
 -                                    struct cpumask *mask,
 +                                    const struct cpumask *mask,
                                      u16 index)
  {
        return 0;
@@@ -2305,10 -2270,12 +2305,10 @@@ static inline bool netif_is_multiqueue(
        return dev->num_tx_queues > 1;
  }
  
 -extern int netif_set_real_num_tx_queues(struct net_device *dev,
 -                                      unsigned int txq);
 +int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq);
  
  #ifdef CONFIG_RPS
 -extern int netif_set_real_num_rx_queues(struct net_device *dev,
 -                                      unsigned int rxq);
 +int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq);
  #else
  static inline int netif_set_real_num_rx_queues(struct net_device *dev,
                                                unsigned int rxq)
@@@ -2335,27 -2302,28 +2335,27 @@@ static inline int netif_copy_real_num_q
  }
  
  #define DEFAULT_MAX_NUM_RSS_QUEUES    (8)
 -extern int netif_get_num_default_rss_queues(void);
 +int netif_get_num_default_rss_queues(void);
  
  /* Use this variant when it is known for sure that it
   * is executing from hardware interrupt context or with hardware interrupts
   * disabled.
   */
 -extern void dev_kfree_skb_irq(struct sk_buff *skb);
 +void dev_kfree_skb_irq(struct sk_buff *skb);
  
  /* Use this variant in places where it could be invoked
   * from either hardware interrupt or other context, with hardware interrupts
   * either disabled or enabled.
   */
 -extern void dev_kfree_skb_any(struct sk_buff *skb);
 +void dev_kfree_skb_any(struct sk_buff *skb);
  
 -extern int            netif_rx(struct sk_buff *skb);
 -extern int            netif_rx_ni(struct sk_buff *skb);
 -extern int            netif_receive_skb(struct sk_buff *skb);
 -extern gro_result_t   napi_gro_receive(struct napi_struct *napi,
 -                                       struct sk_buff *skb);
 -extern void           napi_gro_flush(struct napi_struct *napi, bool flush_old);
 -extern struct sk_buff *       napi_get_frags(struct napi_struct *napi);
 -extern gro_result_t   napi_gro_frags(struct napi_struct *napi);
 +int netif_rx(struct sk_buff *skb);
 +int netif_rx_ni(struct sk_buff *skb);
 +int netif_receive_skb(struct sk_buff *skb);
 +gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
 +void napi_gro_flush(struct napi_struct *napi, bool flush_old);
 +struct sk_buff *napi_get_frags(struct napi_struct *napi);
 +gro_result_t napi_gro_frags(struct napi_struct *napi);
  
  static inline void napi_free_frags(struct napi_struct *napi)
  {
        napi->skb = NULL;
  }
  
 -extern int netdev_rx_handler_register(struct net_device *dev,
 -                                    rx_handler_func_t *rx_handler,
 -                                    void *rx_handler_data);
 -extern void netdev_rx_handler_unregister(struct net_device *dev);
 -
 -extern bool           dev_valid_name(const char *name);
 -extern int            dev_ioctl(struct net *net, unsigned int cmd, void __user *);
 -extern int            dev_ethtool(struct net *net, struct ifreq *);
 -extern unsigned int   dev_get_flags(const struct net_device *);
 -extern int            __dev_change_flags(struct net_device *, unsigned int flags);
 -extern int            dev_change_flags(struct net_device *, unsigned int);
 -extern void           __dev_notify_flags(struct net_device *, unsigned int old_flags);
 -extern int            dev_change_name(struct net_device *, const char *);
 -extern int            dev_set_alias(struct net_device *, const char *, size_t);
 -extern int            dev_change_net_namespace(struct net_device *,
 -                                               struct net *, const char *);
 -extern int            dev_set_mtu(struct net_device *, int);
 -extern void           dev_set_group(struct net_device *, int);
 -extern int            dev_set_mac_address(struct net_device *,
 -                                          struct sockaddr *);
 -extern int            dev_change_carrier(struct net_device *,
 -                                         bool new_carrier);
 -extern int            dev_get_phys_port_id(struct net_device *dev,
 -                                           struct netdev_phys_port_id *ppid);
 -extern int            dev_hard_start_xmit(struct sk_buff *skb,
 -                                          struct net_device *dev,
 -                                          struct netdev_queue *txq);
 -extern int            dev_forward_skb(struct net_device *dev,
 -                                      struct sk_buff *skb);
 +int netdev_rx_handler_register(struct net_device *dev,
 +                             rx_handler_func_t *rx_handler,
 +                             void *rx_handler_data);
 +void netdev_rx_handler_unregister(struct net_device *dev);
 +
 +bool dev_valid_name(const char *name);
 +int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
 +int dev_ethtool(struct net *net, struct ifreq *);
 +unsigned int dev_get_flags(const struct net_device *);
 +int __dev_change_flags(struct net_device *, unsigned int flags);
 +int dev_change_flags(struct net_device *, unsigned int);
 +void __dev_notify_flags(struct net_device *, unsigned int old_flags,
 +                      unsigned int gchanges);
 +int dev_change_name(struct net_device *, const char *);
 +int dev_set_alias(struct net_device *, const char *, size_t);
 +int dev_change_net_namespace(struct net_device *, struct net *, const char *);
 +int dev_set_mtu(struct net_device *, int);
 +void dev_set_group(struct net_device *, int);
 +int dev_set_mac_address(struct net_device *, struct sockaddr *);
 +int dev_change_carrier(struct net_device *, bool new_carrier);
 +int dev_get_phys_port_id(struct net_device *dev,
 +                       struct netdev_phys_port_id *ppid);
 +int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
 +                      struct netdev_queue *txq);
 +int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
  
  extern int            netdev_budget;
  
  /* Called by rtnetlink.c:rtnl_unlock() */
 -extern void netdev_run_todo(void);
 +void netdev_run_todo(void);
  
  /**
   *    dev_put - release reference to device
@@@ -2425,9 -2397,9 +2425,9 @@@ static inline void dev_hold(struct net_
   * kind of lower layer not just hardware media.
   */
  
 -extern void linkwatch_init_dev(struct net_device *dev);
 -extern void linkwatch_fire_event(struct net_device *dev);
 -extern void linkwatch_forget_dev(struct net_device *dev);
 +void linkwatch_init_dev(struct net_device *dev);
 +void linkwatch_fire_event(struct net_device *dev);
 +void linkwatch_forget_dev(struct net_device *dev);
  
  /**
   *    netif_carrier_ok - test if carrier present
@@@ -2440,13 -2412,13 +2440,13 @@@ static inline bool netif_carrier_ok(con
        return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
  }
  
 -extern unsigned long dev_trans_start(struct net_device *dev);
 +unsigned long dev_trans_start(struct net_device *dev);
  
 -extern void __netdev_watchdog_up(struct net_device *dev);
 +void __netdev_watchdog_up(struct net_device *dev);
  
 -extern void netif_carrier_on(struct net_device *dev);
 +void netif_carrier_on(struct net_device *dev);
  
 -extern void netif_carrier_off(struct net_device *dev);
 +void netif_carrier_off(struct net_device *dev);
  
  /**
   *    netif_dormant_on - mark device as dormant.
@@@ -2514,9 -2486,9 +2514,9 @@@ static inline bool netif_device_present
        return test_bit(__LINK_STATE_PRESENT, &dev->state);
  }
  
 -extern void netif_device_detach(struct net_device *dev);
 +void netif_device_detach(struct net_device *dev);
  
 -extern void netif_device_attach(struct net_device *dev);
 +void netif_device_attach(struct net_device *dev);
  
  /*
   * Network interface message level settings
@@@ -2725,138 -2697,119 +2725,138 @@@ static inline void netif_addr_unlock_bh
  
  /* These functions live elsewhere (drivers/net/net_init.c, but related) */
  
 -extern void           ether_setup(struct net_device *dev);
 +void ether_setup(struct net_device *dev);
  
  /* Support for loadable net-drivers */
 -extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 -                                     void (*setup)(struct net_device *),
 -                                     unsigned int txqs, unsigned int rxqs);
 +struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 +                                  void (*setup)(struct net_device *),
 +                                  unsigned int txqs, unsigned int rxqs);
  #define alloc_netdev(sizeof_priv, name, setup) \
        alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
  
  #define alloc_netdev_mq(sizeof_priv, name, setup, count) \
        alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
  
 -extern int            register_netdev(struct net_device *dev);
 -extern void           unregister_netdev(struct net_device *dev);
 +int register_netdev(struct net_device *dev);
 +void unregister_netdev(struct net_device *dev);
  
  /* General hardware address lists handling functions */
 -extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
 -                                struct netdev_hw_addr_list *from_list,
 -                                int addr_len, unsigned char addr_type);
 -extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
 -                                 struct netdev_hw_addr_list *from_list,
 -                                 int addr_len, unsigned char addr_type);
 -extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
 -                        struct netdev_hw_addr_list *from_list,
 -                        int addr_len);
 -extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
 -                           struct netdev_hw_addr_list *from_list,
 -                           int addr_len);
 -extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
 -extern void __hw_addr_init(struct netdev_hw_addr_list *list);
 +int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
 +                         struct netdev_hw_addr_list *from_list,
 +                         int addr_len, unsigned char addr_type);
 +void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
 +                          struct netdev_hw_addr_list *from_list,
 +                          int addr_len, unsigned char addr_type);
 +int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
 +                 struct netdev_hw_addr_list *from_list, int addr_len);
 +void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
 +                    struct netdev_hw_addr_list *from_list, int addr_len);
 +void __hw_addr_flush(struct netdev_hw_addr_list *list);
 +void __hw_addr_init(struct netdev_hw_addr_list *list);
  
  /* Functions used for device addresses handling */
 -extern int dev_addr_add(struct net_device *dev, const unsigned char *addr,
 -                      unsigned char addr_type);
 -extern int dev_addr_del(struct net_device *dev, const unsigned char *addr,
 -                      unsigned char addr_type);
 -extern int dev_addr_add_multiple(struct net_device *to_dev,
 -                               struct net_device *from_dev,
 -                               unsigned char addr_type);
 -extern int dev_addr_del_multiple(struct net_device *to_dev,
 -                               struct net_device *from_dev,
 -                               unsigned char addr_type);
 -extern void dev_addr_flush(struct net_device *dev);
 -extern int dev_addr_init(struct net_device *dev);
 +int dev_addr_add(struct net_device *dev, const unsigned char *addr,
 +               unsigned char addr_type);
 +int dev_addr_del(struct net_device *dev, const unsigned char *addr,
 +               unsigned char addr_type);
 +int dev_addr_add_multiple(struct net_device *to_dev,
 +                        struct net_device *from_dev, unsigned char addr_type);
 +int dev_addr_del_multiple(struct net_device *to_dev,
 +                        struct net_device *from_dev, unsigned char addr_type);
 +void dev_addr_flush(struct net_device *dev);
 +int dev_addr_init(struct net_device *dev);
  
  /* Functions used for unicast addresses handling */
 -extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
 -extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
 -extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
 -extern int dev_uc_sync(struct net_device *to, struct net_device *from);
 -extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
 -extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
 -extern void dev_uc_flush(struct net_device *dev);
 -extern void dev_uc_init(struct net_device *dev);
 +int dev_uc_add(struct net_device *dev, const unsigned char *addr);
 +int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
 +int dev_uc_del(struct net_device *dev, const unsigned char *addr);
 +int dev_uc_sync(struct net_device *to, struct net_device *from);
 +int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
 +void dev_uc_unsync(struct net_device *to, struct net_device *from);
 +void dev_uc_flush(struct net_device *dev);
 +void dev_uc_init(struct net_device *dev);
  
  /* Functions used for multicast addresses handling */
 -extern int dev_mc_add(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
 -extern int dev_mc_sync(struct net_device *to, struct net_device *from);
 -extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
 -extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
 -extern void dev_mc_flush(struct net_device *dev);
 -extern void dev_mc_init(struct net_device *dev);
 +int dev_mc_add(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_del(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
 +int dev_mc_sync(struct net_device *to, struct net_device *from);
 +int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
 +void dev_mc_unsync(struct net_device *to, struct net_device *from);
 +void dev_mc_flush(struct net_device *dev);
 +void dev_mc_init(struct net_device *dev);
  
  /* Functions used for secondary unicast and multicast support */
 -extern void           dev_set_rx_mode(struct net_device *dev);
 -extern void           __dev_set_rx_mode(struct net_device *dev);
 -extern int            dev_set_promiscuity(struct net_device *dev, int inc);
 -extern int            dev_set_allmulti(struct net_device *dev, int inc);
 -extern void           netdev_state_change(struct net_device *dev);
 -extern void           netdev_notify_peers(struct net_device *dev);
 -extern void           netdev_features_change(struct net_device *dev);
 +void dev_set_rx_mode(struct net_device *dev);
 +void __dev_set_rx_mode(struct net_device *dev);
 +int dev_set_promiscuity(struct net_device *dev, int inc);
 +int dev_set_allmulti(struct net_device *dev, int inc);
 +void netdev_state_change(struct net_device *dev);
 +void netdev_notify_peers(struct net_device *dev);
 +void netdev_features_change(struct net_device *dev);
  /* Load a device via the kmod */
 -extern void           dev_load(struct net *net, const char *name);
 -extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
 -                                             struct rtnl_link_stats64 *storage);
 -extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
 -                                  const struct net_device_stats *netdev_stats);
 +void dev_load(struct net *net, const char *name);
 +struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
 +                                      struct rtnl_link_stats64 *storage);
 +void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
 +                           const struct net_device_stats *netdev_stats);
  
  extern int            netdev_max_backlog;
  extern int            netdev_tstamp_prequeue;
  extern int            weight_p;
  extern int            bpf_jit_enable;
  
 -extern bool netdev_has_upper_dev(struct net_device *dev,
 -                               struct net_device *upper_dev);
 -extern bool netdev_has_any_upper_dev(struct net_device *dev);
 -extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
 -                                                      struct list_head **iter);
 +bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
 +bool netdev_has_any_upper_dev(struct net_device *dev);
 +struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
 +                                                   struct list_head **iter);
  
  /* iterate through upper list, must be called under RCU read lock */
 -#define netdev_for_each_upper_dev_rcu(dev, upper, iter) \
 -      for (iter = &(dev)->upper_dev_list, \
 -           upper = netdev_upper_get_next_dev_rcu(dev, &(iter)); \
 -           upper; \
 -           upper = netdev_upper_get_next_dev_rcu(dev, &(iter)))
 -
 -extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
 -extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
 -extern int netdev_upper_dev_link(struct net_device *dev,
 +#define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \
 +      for (iter = &(dev)->all_adj_list.upper, \
 +           updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \
 +           updev; \
 +           updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
 +
 +void *netdev_lower_get_next_private(struct net_device *dev,
 +                                  struct list_head **iter);
 +void *netdev_lower_get_next_private_rcu(struct net_device *dev,
 +                                      struct list_head **iter);
 +
 +#define netdev_for_each_lower_private(dev, priv, iter) \
 +      for (iter = (dev)->adj_list.lower.next, \
 +           priv = netdev_lower_get_next_private(dev, &(iter)); \
 +           priv; \
 +           priv = netdev_lower_get_next_private(dev, &(iter)))
 +
 +#define netdev_for_each_lower_private_rcu(dev, priv, iter) \
 +      for (iter = &(dev)->adj_list.lower, \
 +           priv = netdev_lower_get_next_private_rcu(dev, &(iter)); \
 +           priv; \
 +           priv = netdev_lower_get_next_private_rcu(dev, &(iter)))
 +
 +void *netdev_adjacent_get_private(struct list_head *adj_list);
 +struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
 +struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
 +int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev);
 +int netdev_master_upper_dev_link(struct net_device *dev,
                                 struct net_device *upper_dev);
 -extern int netdev_master_upper_dev_link(struct net_device *dev,
 -                                      struct net_device *upper_dev);
 -extern void netdev_upper_dev_unlink(struct net_device *dev,
 -                                  struct net_device *upper_dev);
 -extern int skb_checksum_help(struct sk_buff *skb);
 -extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 -      netdev_features_t features, bool tx_path);
 -extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
 -                                        netdev_features_t features);
 +int netdev_master_upper_dev_link_private(struct net_device *dev,
 +                                       struct net_device *upper_dev,
 +                                       void *private);
 +void netdev_upper_dev_unlink(struct net_device *dev,
 +                           struct net_device *upper_dev);
 +void *netdev_lower_dev_get_private_rcu(struct net_device *dev,
 +                                     struct net_device *lower_dev);
 +void *netdev_lower_dev_get_private(struct net_device *dev,
 +                                 struct net_device *lower_dev);
 +int skb_checksum_help(struct sk_buff *skb);
 +struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
 +                                netdev_features_t features, bool tx_path);
 +struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
 +                                  netdev_features_t features);
  
  static inline
  struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
@@@ -2878,30 -2831,30 +2878,30 @@@ static inline bool can_checksum_protoco
  }
  
  #ifdef CONFIG_BUG
 -extern void netdev_rx_csum_fault(struct net_device *dev);
 +void netdev_rx_csum_fault(struct net_device *dev);
  #else
  static inline void netdev_rx_csum_fault(struct net_device *dev)
  {
  }
  #endif
  /* rx skb timestamps */
 -extern void           net_enable_timestamp(void);
 -extern void           net_disable_timestamp(void);
 +void net_enable_timestamp(void);
 +void net_disable_timestamp(void);
  
  #ifdef CONFIG_PROC_FS
 -extern int __init dev_proc_init(void);
 +int __init dev_proc_init(void);
  #else
  #define dev_proc_init() 0
  #endif
  
 -extern int netdev_class_create_file(struct class_attribute *class_attr);
 -extern void netdev_class_remove_file(struct class_attribute *class_attr);
 +int netdev_class_create_file(struct class_attribute *class_attr);
 +void netdev_class_remove_file(struct class_attribute *class_attr);
  
  extern struct kobj_ns_type_operations net_ns_type_operations;
  
 -extern const char *netdev_drivername(const struct net_device *dev);
 +const char *netdev_drivername(const struct net_device *dev);
  
 -extern void linkwatch_run_queue(void);
 +void linkwatch_run_queue(void);
  
  static inline netdev_features_t netdev_get_wanted_features(
        struct net_device *dev)
@@@ -2993,22 -2946,22 +2993,22 @@@ static inline const char *netdev_name(c
        return dev->name;
  }
  
 -extern __printf(3, 4)
 +__printf(3, 4)
  int netdev_printk(const char *level, const struct net_device *dev,
                  const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_emerg(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_alert(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_crit(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_err(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_warn(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_notice(const struct net_device *dev, const char *format, ...);
 -extern __printf(2, 3)
 +__printf(2, 3)
  int netdev_info(const struct net_device *dev, const char *format, ...);
  
  #define MODULE_ALIAS_NETDEV(device) \
@@@ -3049,7 -3002,7 +3049,7 @@@ do {                                                            
   * file/line information and a backtrace.
   */
  #define netdev_WARN(dev, format, args...)                     \
 -      WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args);
 +      WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args)
  
  /* netif printk helpers, similar to netdev_printk */
  
index 51329905bfaafda1c290a26103914d5879144a01,7170b4b434e16e8ce90f3d823797f9ced23e82f1..c853b16de4efde38a501440ce58ca260a379e5da
@@@ -131,7 -131,6 +131,7 @@@ struct l2cap_conninfo 
  
  /* L2CAP fixed channels */
  #define L2CAP_FC_L2CAP                0x02
 +#define L2CAP_FC_CONNLESS     0x04
  #define L2CAP_FC_A2MP         0x08
  
  /* L2CAP Control Field bit masks */
@@@ -238,9 -237,8 +238,9 @@@ struct l2cap_conn_rsp 
  /* protocol/service multiplexer (PSM) */
  #define L2CAP_PSM_SDP         0x0001
  #define L2CAP_PSM_RFCOMM      0x0003
 +#define L2CAP_PSM_3DSP                0x0021
  
- /* channel indentifier */
+ /* channel identifier */
  #define L2CAP_CID_SIGNALING   0x0001
  #define L2CAP_CID_CONN_LESS   0x0002
  #define L2CAP_CID_A2MP                0x0003
@@@ -435,6 -433,8 +435,6 @@@ struct l2cap_seq_list 
  #define L2CAP_SEQ_LIST_TAIL   0x8000
  
  struct l2cap_chan {
 -      struct sock *sk;
 -
        struct l2cap_conn       *conn;
        struct hci_conn         *hs_hcon;
        struct hci_chan         *hs_hchan;
  
        __u8            state;
  
 +      bdaddr_t        dst;
 +      __u8            dst_type;
 +      bdaddr_t        src;
 +      __u8            src_type;
        __le16          psm;
 +      __le16          sport;
        __u16           dcid;
        __u16           scid;
  
        __u8            chan_type;
        __u8            chan_policy;
  
 -      __le16          sport;
 -
        __u8            sec_level;
  
        __u8            ident;
@@@ -549,12 -546,9 +549,12 @@@ struct l2cap_ops 
        void                    (*teardown) (struct l2cap_chan *chan, int err);
        void                    (*close) (struct l2cap_chan *chan);
        void                    (*state_change) (struct l2cap_chan *chan,
 -                                               int state);
 +                                               int state, int err);
        void                    (*ready) (struct l2cap_chan *chan);
        void                    (*defer) (struct l2cap_chan *chan);
 +      void                    (*resume) (struct l2cap_chan *chan);
 +      void                    (*set_shutdown) (struct l2cap_chan *chan);
 +      long                    (*get_sndtimeo) (struct l2cap_chan *chan);
        struct sk_buff          *(*alloc_skb) (struct l2cap_chan *chan,
                                               unsigned long len, int nb);
  };
@@@ -563,11 -557,13 +563,11 @@@ struct l2cap_conn 
        struct hci_conn         *hcon;
        struct hci_chan         *hchan;
  
 -      bdaddr_t                *dst;
 -      bdaddr_t                *src;
 -
        unsigned int            mtu;
  
        __u32                   feat_mask;
        __u8                    fixed_chan_mask;
 +      bool                    hs_enabled;
  
        __u8                    info_state;
        __u8                    info_ident;
@@@ -653,7 -649,6 +653,7 @@@ enum 
        FLAG_FLUSHABLE,
        FLAG_EXT_CTRL,
        FLAG_EFS_ENABLE,
 +      FLAG_DEFER_SETUP,
  };
  
  enum {
@@@ -795,19 -790,6 +795,19 @@@ static inline void l2cap_chan_no_defer(
  {
  }
  
 +static inline void l2cap_chan_no_resume(struct l2cap_chan *chan)
 +{
 +}
 +
 +static inline void l2cap_chan_no_set_shutdown(struct l2cap_chan *chan)
 +{
 +}
 +
 +static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
 +{
 +      return 0;
 +}
 +
  extern bool disable_ertm;
  
  int l2cap_init_sockets(void);
@@@ -815,6 -797,7 +815,6 @@@ void l2cap_cleanup_sockets(void)
  bool l2cap_is_socket(struct socket *sock);
  
  void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
 -int __l2cap_wait_ack(struct sock *sk);
  
  int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
  int l2cap_add_scid(struct l2cap_chan *chan,  __u16 scid);
diff --combined init/Kconfig
index 73766535ded5bc0a230248db7f7552bb8df7c53d,7a7acd9a54f5ec16d7603adcc1a0439fe3d2d4e4..4d09f69eb76648a5f2495623acad64747ae9c023
@@@ -284,7 -284,7 +284,7 @@@ config AUDI
  
  config AUDITSYSCALL
        bool "Enable system-call auditing support"
 -      depends on AUDIT && (X86 || PPC || S390 || IA64 || UML || SPARC64 || SUPERH || (ARM && AEABI && !OABI_COMPAT))
 +      depends on AUDIT && (X86 || PARISC || PPC || S390 || IA64 || UML || SPARC64 || SUPERH || (ARM && AEABI && !OABI_COMPAT))
        default y if SECURITY_SELINUX
        help
          Enable low-overhead system-call auditing infrastructure that
@@@ -844,7 -844,7 +844,7 @@@ config NUMA_BALANCING_DEFAULT_ENABLE
        default y
        depends on NUMA_BALANCING
        help
-         If set, autonumic NUMA balancing will be enabled if running on a NUMA
+         If set, automatic NUMA balancing will be enabled if running on a NUMA
          machine.
  
  config NUMA_BALANCING
        help
          This option adds support for automatic NUMA aware memory/task placement.
          The mechanism is quite primitive and is based on migrating memory when
-         it is references to the node the task is running on.
+         it has references to the node the task is running on.
  
          This system will be inactive on UMA systems.
  
@@@ -1123,6 -1123,7 +1123,6 @@@ config IPC_N
  
  config USER_NS
        bool "User namespace"
 -      depends on UIDGID_CONVERTED
        select UIDGID_STRICT_TYPE_CHECKS
  
        default n
@@@ -1156,8 -1157,20 +1156,8 @@@ config NET_N
  
  endif # NAMESPACES
  
 -config UIDGID_CONVERTED
 -      # True if all of the selected software conmponents are known
 -      # to have uid_t and gid_t converted to kuid_t and kgid_t
 -      # where appropriate and are otherwise safe to use with
 -      # the user namespace.
 -      bool
 -      default y
 -
 -      # Filesystems
 -      depends on XFS_FS = n
 -
  config UIDGID_STRICT_TYPE_CHECKS
        bool "Require conversions between uid/gids and their internal representation"
 -      depends on UIDGID_CONVERTED
        default n
        help
         While the nececessary conversions are being added to all subsystems this option allows
@@@ -1602,7 -1615,7 +1602,7 @@@ endchoic
  
  config SLUB_CPU_PARTIAL
        default y
 -      depends on SLUB
 +      depends on SLUB && SMP
        bool "SLUB per cpu partial cache"
        help
          Per cpu partial caches accellerate objects allocation and freeing
@@@ -1668,21 -1681,8 +1668,21 @@@ config BASE_SMAL
        default 0 if BASE_FULL
        default 1 if !BASE_FULL
  
 +config SYSTEM_TRUSTED_KEYRING
 +      bool "Provide system-wide ring of trusted keys"
 +      depends on KEYS
 +      help
 +        Provide a system keyring to which trusted keys can be added.  Keys in
 +        the keyring are considered to be trusted.  Keys may be added at will
 +        by the kernel from compiled-in data and from hardware key stores, but
 +        userspace may only add extra keys if those keys can be verified by
 +        keys already in the keyring.
 +
 +        Keys in this keyring are used by module signature checking.
 +
  menuconfig MODULES
        bool "Enable loadable module support"
 +      option modules
        help
          Kernel modules are small pieces of compiled code which can
          be inserted in the running kernel, rather than being
@@@ -1753,7 -1753,6 +1753,7 @@@ config MODULE_SRCVERSION_AL
  config MODULE_SIG
        bool "Module signature verification"
        depends on MODULES
 +      select SYSTEM_TRUSTED_KEYRING
        select KEYS
        select CRYPTO
        select ASYMMETRIC_KEY_TYPE
diff --combined kernel/kexec.c
index 2a74f307c5ec57b050ceeb8a21341f8a394841ef,cb1f3454eea643d4b57929d463bdfe367a94c07c..490afc03627e52e34e51d69e0a15693b7716b17a
@@@ -921,7 -921,7 +921,7 @@@ static int kimage_load_segment(struct k
   *   reinitialize them.
   *
   * - A machine specific part that includes the syscall number
-  *   and the copies the image to it's final destination.  And
+  *   and then copies the image to it's final destination.  And
   *   jumps into the image at entry.
   *
   * kexec does not sync, or unmount filesystems so if you need
@@@ -1474,8 -1474,11 +1474,8 @@@ static int __init __parse_crashkernel(c
        if (first_colon && (!first_space || first_colon < first_space))
                return parse_crashkernel_mem(ck_cmdline, system_ram,
                                crash_size, crash_base);
 -      else
 -              return parse_crashkernel_simple(ck_cmdline, crash_size,
 -                              crash_base);
  
 -      return 0;
 +      return parse_crashkernel_simple(ck_cmdline, crash_size, crash_base);
  }
  
  /*
index 947ba25a95a0aeb51415591ab8e19fb1a846b989,5bb5056fbfb46542512a138a7b8d55f89bc50f80..3abf53418b67c6ee92c16522299a8821856b749d
@@@ -1613,9 -1613,10 +1613,10 @@@ void get_xtime_and_monotonic_and_sleep_
   * ktime_get_update_offsets - hrtimer helper
   * @offs_real:        pointer to storage for monotonic -> realtime offset
   * @offs_boot:        pointer to storage for monotonic -> boottime offset
+  * @offs_tai: pointer to storage for monotonic -> clock tai offset
   *
   * Returns current monotonic time and updates the offsets
-  * Called from hrtimer_interupt() or retrigger_next_event()
+  * Called from hrtimer_interrupt() or retrigger_next_event()
   */
  ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot,
                                                        ktime_t *offs_tai)
@@@ -1703,8 -1704,6 +1704,8 @@@ int do_adjtimex(struct timex *txc
        write_seqcount_end(&timekeeper_seq);
        raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
  
 +      ntp_notify_cmos_timer();
 +
        return ret;
  }
  
diff --combined mm/Kconfig
index 394838f489ebae1b9d00660af54ceac857538653,79ac9915d5041f98cbd43a920927a0331b97859c..fdd5ce227e5b2b2d9cf4ba9f4ae24de8c697e885
@@@ -20,7 -20,7 +20,7 @@@ config FLATMEM_MANUA
  
          Some users of more advanced features like NUMA and
          memory hotplug may have different options here.
-         DISCONTIGMEM is an more mature, better tested system,
+         DISCONTIGMEM is a more mature, better tested system,
          but is incompatible with memory hotplug and may suffer
          decreased performance over SPARSEMEM.  If unsure between
          "Sparse Memory" and "Discontiguous Memory", choose
@@@ -183,7 -183,7 +183,7 @@@ config MEMORY_HOTPLUG_SPARS
  config MEMORY_HOTREMOVE
        bool "Allow for memory hot remove"
        select MEMORY_ISOLATION
 -      select HAVE_BOOTMEM_INFO_NODE if X86_64
 +      select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
        depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
        depends on MIGRATION
  
@@@ -245,7 -245,7 +245,7 @@@ config COMPACTIO
  config MIGRATION
        bool "Page migration"
        def_bool y
 -      depends on NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA
 +      depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
        help
          Allows the migration of the physical location of pages of processes
          while the virtual addresses are not changed. This is useful in
@@@ -480,7 -480,7 +480,7 @@@ config FRONTSWA
  
  config CMA
        bool "Contiguous Memory Allocator"
 -      depends on HAVE_MEMBLOCK
 +      depends on HAVE_MEMBLOCK && MMU
        select MIGRATION
        select MEMORY_ISOLATION
        help
diff --combined mm/slub.c
index c3eb3d3ca83565b925e197f2ad44ac2c313345b8,6a2fa986e7a74e62f2af93b2f857dc1ad6897ace..c9aa8d429da53681799c49d996c7d87435549196
+++ b/mm/slub.c
@@@ -373,8 -373,7 +373,8 @@@ static inline bool __cmpxchg_double_sla
  #endif
        {
                slab_lock(page);
 -              if (page->freelist == freelist_old && page->counters == counters_old) {
 +              if (page->freelist == freelist_old &&
 +                                      page->counters == counters_old) {
                        page->freelist = freelist_new;
                        page->counters = counters_new;
                        slab_unlock(page);
@@@ -412,8 -411,7 +412,8 @@@ static inline bool cmpxchg_double_slab(
  
                local_irq_save(flags);
                slab_lock(page);
 -              if (page->freelist == freelist_old && page->counters == counters_old) {
 +              if (page->freelist == freelist_old &&
 +                                      page->counters == counters_old) {
                        page->freelist = freelist_new;
                        page->counters = counters_new;
                        slab_unlock(page);
@@@ -555,9 -553,8 +555,9 @@@ static void print_tracking(struct kmem_
  
  static void print_page_info(struct page *page)
  {
 -      printk(KERN_ERR "INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=0x%04lx\n",
 -              page, page->objects, page->inuse, page->freelist, page->flags);
 +      printk(KERN_ERR
 +             "INFO: Slab 0x%p objects=%u used=%u fp=0x%p flags=0x%04lx\n",
 +             page, page->objects, page->inuse, page->freelist, page->flags);
  
  }
  
@@@ -632,8 -629,7 +632,8 @@@ static void object_err(struct kmem_cach
        print_trailer(s, page, object);
  }
  
 -static void slab_err(struct kmem_cache *s, struct page *page, const char *fmt, ...)
 +static void slab_err(struct kmem_cache *s, struct page *page,
 +                      const char *fmt, ...)
  {
        va_list args;
        char buf[100];
@@@ -792,8 -788,7 +792,8 @@@ static int check_object(struct kmem_cac
        } else {
                if ((s->flags & SLAB_POISON) && s->object_size < s->inuse) {
                        check_bytes_and_report(s, page, p, "Alignment padding",
 -                              endobject, POISON_INUSE, s->inuse - s->object_size);
 +                              endobject, POISON_INUSE,
 +                              s->inuse - s->object_size);
                }
        }
  
@@@ -878,6 -873,7 +878,6 @@@ static int on_freelist(struct kmem_cach
                                object_err(s, page, object,
                                        "Freechain corrupt");
                                set_freepointer(s, object, NULL);
 -                              break;
                        } else {
                                slab_err(s, page, "Freepointer corrupt");
                                page->freelist = NULL;
@@@ -922,8 -918,7 +922,8 @@@ static void trace(struct kmem_cache *s
                        page->freelist);
  
                if (!alloc)
 -                      print_section("Object ", (void *)object, s->object_size);
 +                      print_section("Object ", (void *)object,
 +                                      s->object_size);
  
                dump_stack();
        }
@@@ -942,8 -937,7 +942,8 @@@ static inline int slab_pre_alloc_hook(s
        return should_failslab(s->object_size, flags, s->flags);
  }
  
 -static inline void slab_post_alloc_hook(struct kmem_cache *s, gfp_t flags, void *object)
 +static inline void slab_post_alloc_hook(struct kmem_cache *s,
 +                                      gfp_t flags, void *object)
  {
        flags &= gfp_allowed_mask;
        kmemcheck_slab_alloc(s, flags, object, slab_ksize(s));
@@@ -955,7 -949,7 +955,7 @@@ static inline void slab_free_hook(struc
        kmemleak_free_recursive(x, s->flags);
  
        /*
-        * Trouble is that we may no longer disable interupts in the fast path
+        * Trouble is that we may no longer disable interrupts in the fast path
         * So in order to make the debug calls that expect irqs to be
         * disabled we need to disable interrupts temporarily.
         */
@@@ -1045,8 -1039,7 +1045,8 @@@ static void setup_object_debug(struct k
        init_tracking(s, object);
  }
  
 -static noinline int alloc_debug_processing(struct kmem_cache *s, struct page *page,
 +static noinline int alloc_debug_processing(struct kmem_cache *s,
 +                                      struct page *page,
                                        void *object, unsigned long addr)
  {
        if (!check_slab(s, page))
@@@ -1750,8 -1743,7 +1750,8 @@@ static void init_kmem_cache_cpus(struc
  /*
   * Remove the cpu slab
   */
 -static void deactivate_slab(struct kmem_cache *s, struct page *page, void *freelist)
 +static void deactivate_slab(struct kmem_cache *s, struct page *page,
 +                              void *freelist)
  {
        enum slab_modes { M_NONE, M_PARTIAL, M_FULL, M_FREE };
        struct kmem_cache_node *n = get_node(s, page_to_nid(page));
@@@ -2007,8 -1999,7 +2007,8 @@@ static void put_cpu_partial(struct kmem
                page->pobjects = pobjects;
                page->next = oldpage;
  
 -      } while (this_cpu_cmpxchg(s->cpu_slab->partial, oldpage, page) != oldpage);
 +      } while (this_cpu_cmpxchg(s->cpu_slab->partial, oldpage, page)
 +                                                              != oldpage);
  #endif
  }
  
@@@ -2178,8 -2169,8 +2178,8 @@@ static inline bool pfmemalloc_match(str
  }
  
  /*
 - * Check the page->freelist of a page and either transfer the freelist to the per cpu freelist
 - * or deactivate the page.
 + * Check the page->freelist of a page and either transfer the freelist to the
 + * per cpu freelist or deactivate the page.
   *
   * The page is still frozen if the return value is not NULL.
   *
@@@ -2323,8 -2314,7 +2323,8 @@@ new_slab
                goto load_freelist;
  
        /* Only entered in the debug case */
 -      if (kmem_cache_debug(s) && !alloc_debug_processing(s, page, freelist, addr))
 +      if (kmem_cache_debug(s) &&
 +                      !alloc_debug_processing(s, page, freelist, addr))
                goto new_slab;  /* Slab failed checks. Next slab needed */
  
        deactivate_slab(s, page, get_freepointer(s, freelist));
@@@ -2382,7 -2372,7 +2382,7 @@@ redo
  
        object = c->freelist;
        page = c->page;
 -      if (unlikely(!object || !page || !node_match(page, node)))
 +      if (unlikely(!object || !node_match(page, node)))
                object = __slab_alloc(s, gfpflags, node, addr, c);
  
        else {
                 * The cmpxchg will only match if there was no additional
                 * operation and if we are on the right processor.
                 *
 -               * The cmpxchg does the following atomically (without lock semantics!)
 +               * The cmpxchg does the following atomically (without lock
 +               * semantics!)
                 * 1. Relocate first pointer to the current per cpu area.
                 * 2. Verify that tid and freelist have not been changed
                 * 3. If they were not changed replace tid and freelist
                 *
 -               * Since this is without lock semantics the protection is only against
 -               * code executing on this cpu *not* from access by other cpus.
 +               * Since this is without lock semantics the protection is only
 +               * against code executing on this cpu *not* from access by
 +               * other cpus.
                 */
                if (unlikely(!this_cpu_cmpxchg_double(
                                s->cpu_slab->freelist, s->cpu_slab->tid,
@@@ -2432,8 -2420,7 +2432,8 @@@ void *kmem_cache_alloc(struct kmem_cach
  {
        void *ret = slab_alloc(s, gfpflags, _RET_IP_);
  
 -      trace_kmem_cache_alloc(_RET_IP_, ret, s->object_size, s->size, gfpflags);
 +      trace_kmem_cache_alloc(_RET_IP_, ret, s->object_size,
 +                              s->size, gfpflags);
  
        return ret;
  }
@@@ -2447,6 -2434,14 +2447,6 @@@ void *kmem_cache_alloc_trace(struct kme
        return ret;
  }
  EXPORT_SYMBOL(kmem_cache_alloc_trace);
 -
 -void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
 -{
 -      void *ret = kmalloc_order(size, flags, order);
 -      trace_kmalloc(_RET_IP_, ret, size, PAGE_SIZE << order, flags);
 -      return ret;
 -}
 -EXPORT_SYMBOL(kmalloc_order_trace);
  #endif
  
  #ifdef CONFIG_NUMA
@@@ -2517,10 -2512,8 +2517,10 @@@ static void __slab_free(struct kmem_cac
                        if (kmem_cache_has_cpu_partial(s) && !prior)
  
                                /*
 -                               * Slab was on no list before and will be partially empty
 -                               * We can defer the list move and instead freeze it.
 +                               * Slab was on no list before and will be
 +                               * partially empty
 +                               * We can defer the list move and instead
 +                               * freeze it.
                                 */
                                new.frozen = 1;
  
@@@ -3078,8 -3071,8 +3078,8 @@@ static int kmem_cache_open(struct kmem_
         * A) The number of objects from per cpu partial slabs dumped to the
         *    per node list when we reach the limit.
         * B) The number of objects in cpu partial slabs to extract from the
 -       *    per node list when we run out of per cpu objects. We only fetch 50%
 -       *    to keep some capacity around for frees.
 +       *    per node list when we run out of per cpu objects. We only fetch
 +       *    50% to keep some capacity around for frees.
         */
        if (!kmem_cache_has_cpu_partial(s))
                s->cpu_partial = 0;
@@@ -3106,8 -3099,8 +3106,8 @@@ error
        if (flags & SLAB_PANIC)
                panic("Cannot create slab %s size=%lu realsize=%u "
                        "order=%u offset=%u flags=%lx\n",
 -                      s->name, (unsigned long)s->size, s->size, oo_order(s->oo),
 -                      s->offset, flags);
 +                      s->name, (unsigned long)s->size, s->size,
 +                      oo_order(s->oo), s->offset, flags);
        return -EINVAL;
  }
  
@@@ -3323,6 -3316,42 +3323,6 @@@ size_t ksize(const void *object
  }
  EXPORT_SYMBOL(ksize);
  
 -#ifdef CONFIG_SLUB_DEBUG
 -bool verify_mem_not_deleted(const void *x)
 -{
 -      struct page *page;
 -      void *object = (void *)x;
 -      unsigned long flags;
 -      bool rv;
 -
 -      if (unlikely(ZERO_OR_NULL_PTR(x)))
 -              return false;
 -
 -      local_irq_save(flags);
 -
 -      page = virt_to_head_page(x);
 -      if (unlikely(!PageSlab(page))) {
 -              /* maybe it was from stack? */
 -              rv = true;
 -              goto out_unlock;
 -      }
 -
 -      slab_lock(page);
 -      if (on_freelist(page->slab_cache, page, object)) {
 -              object_err(page->slab_cache, page, object, "Object is on free-list");
 -              rv = false;
 -      } else {
 -              rv = true;
 -      }
 -      slab_unlock(page);
 -
 -out_unlock:
 -      local_irq_restore(flags);
 -      return rv;
 -}
 -EXPORT_SYMBOL(verify_mem_not_deleted);
 -#endif
 -
  void kfree(const void *x)
  {
        struct page *page;
@@@ -4133,17 -4162,15 +4133,17 @@@ static int list_locations(struct kmem_c
                                !cpumask_empty(to_cpumask(l->cpus)) &&
                                len < PAGE_SIZE - 60) {
                        len += sprintf(buf + len, " cpus=");
 -                      len += cpulist_scnprintf(buf + len, PAGE_SIZE - len - 50,
 +                      len += cpulist_scnprintf(buf + len,
 +                                               PAGE_SIZE - len - 50,
                                                 to_cpumask(l->cpus));
                }
  
                if (nr_online_nodes > 1 && !nodes_empty(l->nodes) &&
                                len < PAGE_SIZE - 60) {
                        len += sprintf(buf + len, " nodes=");
 -                      len += nodelist_scnprintf(buf + len, PAGE_SIZE - len - 50,
 -                                      l->nodes);
 +                      len += nodelist_scnprintf(buf + len,
 +                                                PAGE_SIZE - len - 50,
 +                                                l->nodes);
                }
  
                len += sprintf(buf + len, "\n");
@@@ -4241,17 -4268,18 +4241,17 @@@ static ssize_t show_slab_objects(struc
        int node;
        int x;
        unsigned long *nodes;
 -      unsigned long *per_cpu;
  
 -      nodes = kzalloc(2 * sizeof(unsigned long) * nr_node_ids, GFP_KERNEL);
 +      nodes = kzalloc(sizeof(unsigned long) * nr_node_ids, GFP_KERNEL);
        if (!nodes)
                return -ENOMEM;
 -      per_cpu = nodes + nr_node_ids;
  
        if (flags & SO_CPU) {
                int cpu;
  
                for_each_possible_cpu(cpu) {
 -                      struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu);
 +                      struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab,
 +                                                             cpu);
                        int node;
                        struct page *page;
  
                                total += x;
                                nodes[node] += x;
                        }
 -
 -                      per_cpu[node]++;
                }
        }
  
                for_each_node_state(node, N_NORMAL_MEMORY) {
                        struct kmem_cache_node *n = get_node(s, node);
  
 -              if (flags & SO_TOTAL)
 -                      x = atomic_long_read(&n->total_objects);
 -              else if (flags & SO_OBJECTS)
 -                      x = atomic_long_read(&n->total_objects) -
 -                              count_partial(n, count_free);
 -
 +                      if (flags & SO_TOTAL)
 +                              x = atomic_long_read(&n->total_objects);
 +                      else if (flags & SO_OBJECTS)
 +                              x = atomic_long_read(&n->total_objects) -
 +                                      count_partial(n, count_free);
                        else
                                x = atomic_long_read(&n->nr_slabs);
                        total += x;
@@@ -4389,7 -4420,7 +4389,7 @@@ static ssize_t order_store(struct kmem_
        unsigned long order;
        int err;
  
 -      err = strict_strtoul(buf, 10, &order);
 +      err = kstrtoul(buf, 10, &order);
        if (err)
                return err;
  
@@@ -4417,7 -4448,7 +4417,7 @@@ static ssize_t min_partial_store(struc
        unsigned long min;
        int err;
  
 -      err = strict_strtoul(buf, 10, &min);
 +      err = kstrtoul(buf, 10, &min);
        if (err)
                return err;
  
@@@ -4437,7 -4468,7 +4437,7 @@@ static ssize_t cpu_partial_store(struc
        unsigned long objects;
        int err;
  
 -      err = strict_strtoul(buf, 10, &objects);
 +      err = kstrtoul(buf, 10, &objects);
        if (err)
                return err;
        if (objects && !kmem_cache_has_cpu_partial(s))
@@@ -4753,7 -4784,7 +4753,7 @@@ static ssize_t remote_node_defrag_ratio
        unsigned long ratio;
        int err;
  
 -      err = strict_strtoul(buf, 10, &ratio);
 +      err = kstrtoul(buf, 10, &ratio);
        if (err)
                return err;
  
@@@ -5105,8 -5136,7 +5105,8 @@@ static char *create_unique_id(struct km
  
  #ifdef CONFIG_MEMCG_KMEM
        if (!is_root_cache(s))
 -              p += sprintf(p, "-%08d", memcg_cache_id(s->memcg_params->memcg));
 +              p += sprintf(p, "-%08d",
 +                              memcg_cache_id(s->memcg_params->memcg));
  #endif
  
        BUG_ON(p > name + ID_STR_LENGTH - 1);
diff --combined net/netfilter/xt_set.c
index e7c4e0e01ff5de40fb32cdeddd70cb204b84ea32,4b9d6b4f1eb0886028cddf687e659ee468edd4bf..80c2e2d603e00c718ad1744804ef29f926b9d404
@@@ -81,17 -81,17 +81,17 @@@ set_match_v0_checkentry(const struct xt
        struct xt_set_info_match_v0 *info = par->matchinfo;
        ip_set_id_t index;
  
 -      index = ip_set_nfnl_get_byindex(info->match_set.index);
 +      index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);
  
        if (index == IPSET_INVALID_ID) {
-               pr_warning("Cannot find set indentified by id %u to match\n",
+               pr_warning("Cannot find set identified by id %u to match\n",
                           info->match_set.index);
                return -ENOENT;
        }
        if (info->match_set.u.flags[IPSET_DIM_MAX-1] != 0) {
                pr_warning("Protocol error: set match dimension "
                           "is over the limit!\n");
 -              ip_set_nfnl_put(info->match_set.index);
 +              ip_set_nfnl_put(par->net, info->match_set.index);
                return -ERANGE;
        }
  
@@@ -106,104 -106,9 +106,104 @@@ set_match_v0_destroy(const struct xt_mt
  {
        struct xt_set_info_match_v0 *info = par->matchinfo;
  
 -      ip_set_nfnl_put(info->match_set.index);
 +      ip_set_nfnl_put(par->net, info->match_set.index);
  }
  
-               pr_warning("Cannot find set indentified by id %u to match\n",
 +/* Revision 1 match */
 +
 +static bool
 +set_match_v1(const struct sk_buff *skb, struct xt_action_param *par)
 +{
 +      const struct xt_set_info_match_v1 *info = par->matchinfo;
 +      ADT_OPT(opt, par->family, info->match_set.dim,
 +              info->match_set.flags, 0, UINT_MAX);
 +
 +      if (opt.flags & IPSET_RETURN_NOMATCH)
 +              opt.cmdflags |= IPSET_FLAG_RETURN_NOMATCH;
 +
 +      return match_set(info->match_set.index, skb, par, &opt,
 +                       info->match_set.flags & IPSET_INV_MATCH);
 +}
 +
 +static int
 +set_match_v1_checkentry(const struct xt_mtchk_param *par)
 +{
 +      struct xt_set_info_match_v1 *info = par->matchinfo;
 +      ip_set_id_t index;
 +
 +      index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);
 +
 +      if (index == IPSET_INVALID_ID) {
++              pr_warning("Cannot find set identified by id %u to match\n",
 +                         info->match_set.index);
 +              return -ENOENT;
 +      }
 +      if (info->match_set.dim > IPSET_DIM_MAX) {
 +              pr_warning("Protocol error: set match dimension "
 +                         "is over the limit!\n");
 +              ip_set_nfnl_put(par->net, info->match_set.index);
 +              return -ERANGE;
 +      }
 +
 +      return 0;
 +}
 +
 +static void
 +set_match_v1_destroy(const struct xt_mtdtor_param *par)
 +{
 +      struct xt_set_info_match_v1 *info = par->matchinfo;
 +
 +      ip_set_nfnl_put(par->net, info->match_set.index);
 +}
 +
 +/* Revision 3 match */
 +
 +static bool
 +match_counter(u64 counter, const struct ip_set_counter_match *info)
 +{
 +      switch (info->op) {
 +      case IPSET_COUNTER_NONE:
 +              return true;
 +      case IPSET_COUNTER_EQ:
 +              return counter == info->value;
 +      case IPSET_COUNTER_NE:
 +              return counter != info->value;
 +      case IPSET_COUNTER_LT:
 +              return counter < info->value;
 +      case IPSET_COUNTER_GT:
 +              return counter > info->value;
 +      }
 +      return false;
 +}
 +
 +static bool
 +set_match_v3(const struct sk_buff *skb, struct xt_action_param *par)
 +{
 +      const struct xt_set_info_match_v3 *info = par->matchinfo;
 +      ADT_OPT(opt, par->family, info->match_set.dim,
 +              info->match_set.flags, info->flags, UINT_MAX);
 +      int ret;
 +
 +      if (info->packets.op != IPSET_COUNTER_NONE ||
 +          info->bytes.op != IPSET_COUNTER_NONE)
 +              opt.cmdflags |= IPSET_FLAG_MATCH_COUNTERS;
 +
 +      ret = match_set(info->match_set.index, skb, par, &opt,
 +                      info->match_set.flags & IPSET_INV_MATCH);
 +
 +      if (!(ret && opt.cmdflags & IPSET_FLAG_MATCH_COUNTERS))
 +              return ret;
 +
 +      if (!match_counter(opt.ext.packets, &info->packets))
 +              return 0;
 +      return match_counter(opt.ext.bytes, &info->bytes);
 +}
 +
 +#define set_match_v3_checkentry       set_match_v1_checkentry
 +#define set_match_v3_destroy  set_match_v1_destroy
 +
 +/* Revision 0 interface: backward compatible with netfilter/iptables */
 +
  static unsigned int
  set_target_v0(struct sk_buff *skb, const struct xt_action_param *par)
  {
@@@ -228,7 -133,7 +228,7 @@@ set_target_v0_checkentry(const struct x
        ip_set_id_t index;
  
        if (info->add_set.index != IPSET_INVALID_ID) {
 -              index = ip_set_nfnl_get_byindex(info->add_set.index);
 +              index = ip_set_nfnl_get_byindex(par->net, info->add_set.index);
                if (index == IPSET_INVALID_ID) {
                        pr_warning("Cannot find add_set index %u as target\n",
                                   info->add_set.index);
        }
  
        if (info->del_set.index != IPSET_INVALID_ID) {
 -              index = ip_set_nfnl_get_byindex(info->del_set.index);
 +              index = ip_set_nfnl_get_byindex(par->net, info->del_set.index);
                if (index == IPSET_INVALID_ID) {
                        pr_warning("Cannot find del_set index %u as target\n",
                                   info->del_set.index);
                        if (info->add_set.index != IPSET_INVALID_ID)
 -                              ip_set_nfnl_put(info->add_set.index);
 +                              ip_set_nfnl_put(par->net, info->add_set.index);
                        return -ENOENT;
                }
        }
                pr_warning("Protocol error: SET target dimension "
                           "is over the limit!\n");
                if (info->add_set.index != IPSET_INVALID_ID)
 -                      ip_set_nfnl_put(info->add_set.index);
 +                      ip_set_nfnl_put(par->net, info->add_set.index);
                if (info->del_set.index != IPSET_INVALID_ID)
 -                      ip_set_nfnl_put(info->del_set.index);
 +                      ip_set_nfnl_put(par->net, info->del_set.index);
                return -ERANGE;
        }
  
@@@ -270,12 -175,57 +270,12 @@@ set_target_v0_destroy(const struct xt_t
        const struct xt_set_info_target_v0 *info = par->targinfo;
  
        if (info->add_set.index != IPSET_INVALID_ID)
 -              ip_set_nfnl_put(info->add_set.index);
 +              ip_set_nfnl_put(par->net, info->add_set.index);
        if (info->del_set.index != IPSET_INVALID_ID)
 -              ip_set_nfnl_put(info->del_set.index);
 +              ip_set_nfnl_put(par->net, info->del_set.index);
  }
  
 -/* Revision 1 match and target */
 -
 -static bool
 -set_match_v1(const struct sk_buff *skb, struct xt_action_param *par)
 -{
 -      const struct xt_set_info_match_v1 *info = par->matchinfo;
 -      ADT_OPT(opt, par->family, info->match_set.dim,
 -              info->match_set.flags, 0, UINT_MAX);
 -
 -      if (opt.flags & IPSET_RETURN_NOMATCH)
 -              opt.cmdflags |= IPSET_FLAG_RETURN_NOMATCH;
 -
 -      return match_set(info->match_set.index, skb, par, &opt,
 -                       info->match_set.flags & IPSET_INV_MATCH);
 -}
 -
 -static int
 -set_match_v1_checkentry(const struct xt_mtchk_param *par)
 -{
 -      struct xt_set_info_match_v1 *info = par->matchinfo;
 -      ip_set_id_t index;
 -
 -      index = ip_set_nfnl_get_byindex(info->match_set.index);
 -
 -      if (index == IPSET_INVALID_ID) {
 -              pr_warning("Cannot find set identified by id %u to match\n",
 -                         info->match_set.index);
 -              return -ENOENT;
 -      }
 -      if (info->match_set.dim > IPSET_DIM_MAX) {
 -              pr_warning("Protocol error: set match dimension "
 -                         "is over the limit!\n");
 -              ip_set_nfnl_put(info->match_set.index);
 -              return -ERANGE;
 -      }
 -
 -      return 0;
 -}
 -
 -static void
 -set_match_v1_destroy(const struct xt_mtdtor_param *par)
 -{
 -      struct xt_set_info_match_v1 *info = par->matchinfo;
 -
 -      ip_set_nfnl_put(info->match_set.index);
 -}
 +/* Revision 1 target */
  
  static unsigned int
  set_target_v1(struct sk_buff *skb, const struct xt_action_param *par)
@@@ -301,7 -251,7 +301,7 @@@ set_target_v1_checkentry(const struct x
        ip_set_id_t index;
  
        if (info->add_set.index != IPSET_INVALID_ID) {
 -              index = ip_set_nfnl_get_byindex(info->add_set.index);
 +              index = ip_set_nfnl_get_byindex(par->net, info->add_set.index);
                if (index == IPSET_INVALID_ID) {
                        pr_warning("Cannot find add_set index %u as target\n",
                                   info->add_set.index);
        }
  
        if (info->del_set.index != IPSET_INVALID_ID) {
 -              index = ip_set_nfnl_get_byindex(info->del_set.index);
 +              index = ip_set_nfnl_get_byindex(par->net, info->del_set.index);
                if (index == IPSET_INVALID_ID) {
                        pr_warning("Cannot find del_set index %u as target\n",
                                   info->del_set.index);
                        if (info->add_set.index != IPSET_INVALID_ID)
 -                              ip_set_nfnl_put(info->add_set.index);
 +                              ip_set_nfnl_put(par->net, info->add_set.index);
                        return -ENOENT;
                }
        }
                pr_warning("Protocol error: SET target dimension "
                           "is over the limit!\n");
                if (info->add_set.index != IPSET_INVALID_ID)
 -                      ip_set_nfnl_put(info->add_set.index);
 +                      ip_set_nfnl_put(par->net, info->add_set.index);
                if (info->del_set.index != IPSET_INVALID_ID)
 -                      ip_set_nfnl_put(info->del_set.index);
 +                      ip_set_nfnl_put(par->net, info->del_set.index);
                return -ERANGE;
        }
  
@@@ -339,9 -289,9 +339,9 @@@ set_target_v1_destroy(const struct xt_t
        const struct xt_set_info_target_v1 *info = par->targinfo;
  
        if (info->add_set.index != IPSET_INVALID_ID)
 -              ip_set_nfnl_put(info->add_set.index);
 +              ip_set_nfnl_put(par->net, info->add_set.index);
        if (info->del_set.index != IPSET_INVALID_ID)
 -              ip_set_nfnl_put(info->del_set.index);
 +              ip_set_nfnl_put(par->net, info->del_set.index);
  }
  
  /* Revision 2 target */
@@@ -370,6 -320,52 +370,6 @@@ set_target_v2(struct sk_buff *skb, cons
  #define set_target_v2_checkentry      set_target_v1_checkentry
  #define set_target_v2_destroy         set_target_v1_destroy
  
 -/* Revision 3 match */
 -
 -static bool
 -match_counter(u64 counter, const struct ip_set_counter_match *info)
 -{
 -      switch (info->op) {
 -      case IPSET_COUNTER_NONE:
 -              return true;
 -      case IPSET_COUNTER_EQ:
 -              return counter == info->value;
 -      case IPSET_COUNTER_NE:
 -              return counter != info->value;
 -      case IPSET_COUNTER_LT:
 -              return counter < info->value;
 -      case IPSET_COUNTER_GT:
 -              return counter > info->value;
 -      }
 -      return false;
 -}
 -
 -static bool
 -set_match_v3(const struct sk_buff *skb, struct xt_action_param *par)
 -{
 -      const struct xt_set_info_match_v3 *info = par->matchinfo;
 -      ADT_OPT(opt, par->family, info->match_set.dim,
 -              info->match_set.flags, info->flags, UINT_MAX);
 -      int ret;
 -
 -      if (info->packets.op != IPSET_COUNTER_NONE ||
 -          info->bytes.op != IPSET_COUNTER_NONE)
 -              opt.cmdflags |= IPSET_FLAG_MATCH_COUNTERS;
 -
 -      ret = match_set(info->match_set.index, skb, par, &opt,
 -                      info->match_set.flags & IPSET_INV_MATCH);
 -
 -      if (!(ret && opt.cmdflags & IPSET_FLAG_MATCH_COUNTERS))
 -              return ret;
 -
 -      if (!match_counter(opt.ext.packets, &info->packets))
 -              return 0;
 -      return match_counter(opt.ext.bytes, &info->bytes);
 -}
 -
 -#define set_match_v3_checkentry       set_match_v1_checkentry
 -#define set_match_v3_destroy  set_match_v1_destroy
 -
  static struct xt_match set_matches[] __read_mostly = {
        {
                .name           = "set",