Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
authorJohn W. Linville <linville@tuxdriver.com>
Mon, 6 Feb 2012 19:26:39 +0000 (14:26 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 6 Feb 2012 19:26:39 +0000 (14:26 -0500)
Conflicts:
drivers/net/wireless/rtlwifi/rtl8192se/sw.c

15 files changed:
1  2 
MAINTAINERS
drivers/net/wireless/b43/main.c
drivers/net/wireless/brcm80211/brcmsmac/main.c
drivers/net/wireless/iwlwifi/iwl-agn-tx.c
drivers/net/wireless/iwlwifi/iwl-commands.h
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rtlwifi/rtl8192se/sw.c
net/mac80211/ibss.c
net/mac80211/iface.c
net/mac80211/mesh_hwmp.c
net/mac80211/mesh_plink.c
net/mac80211/mlme.c
net/mac80211/rx.c

diff --combined MAINTAINERS
@@@ -745,7 -745,6 +745,7 @@@ M: Barry Song <baohua.song@csr.com
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
  F:    arch/arm/mach-prima2/
 +F:    drivers/dma/sirf-dma*
  
  ARM/EBSA110 MACHINE SUPPORT
  M:    Russell King <linux@arm.linux.org.uk>
@@@ -1412,7 -1411,7 +1412,7 @@@ F:      net/ax25
  B43 WIRELESS DRIVER
  M:    Stefano Brivio <stefano.brivio@polimi.it>
  L:    linux-wireless@vger.kernel.org
- L:    b43-dev@lists.infradead.org (moderated for non-subscribers)
+ L:    b43-dev@lists.infradead.org
  W:    http://linuxwireless.org/en/users/Drivers/b43
  S:    Maintained
  F:    drivers/net/wireless/b43/
@@@ -1421,6 -1420,7 +1421,7 @@@ B43LEGACY WIRELESS DRIVE
  M:    Larry Finger <Larry.Finger@lwfinger.net>
  M:    Stefano Brivio <stefano.brivio@polimi.it>
  L:    linux-wireless@vger.kernel.org
+ L:    b43-dev@lists.infradead.org
  W:    http://linuxwireless.org/en/users/Drivers/b43
  S:    Maintained
  F:    drivers/net/wireless/b43legacy/
@@@ -1804,8 -1804,7 +1805,8 @@@ F:      Documentation/zh_CN
  CISCO VIC ETHERNET NIC DRIVER
  M:    Christian Benvenuti <benve@cisco.com>
  M:    Roopa Prabhu <roprabhu@cisco.com>
 -M:    David Wang <dwang2@cisco.com>
 +M:    Neel Patel <neepatel@cisco.com>
 +M:    Nishank Trivedi <nistrive@cisco.com>
  S:    Supported
  F:    drivers/net/ethernet/cisco/enic/
  
@@@ -2247,17 -2246,6 +2248,17 @@@ T:    git git://git.kernel.org/pub/scm/lin
  S:    Supported
  F:    fs/dlm/
  
 +DMA BUFFER SHARING FRAMEWORK
 +M:    Sumit Semwal <sumit.semwal@linaro.org>
 +S:    Maintained
 +L:    linux-media@vger.kernel.org
 +L:    dri-devel@lists.freedesktop.org
 +L:    linaro-mm-sig@lists.linaro.org
 +F:    drivers/base/dma-buf*
 +F:    include/linux/dma-buf*
 +F:    Documentation/dma-buf-sharing.txt
 +T:    git git://git.linaro.org/people/sumitsemwal/linux-dma-buf.git
 +
  DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
  M:    Vinod Koul <vinod.koul@intel.com>
  M:    Dan Williams <dan.j.williams@intel.com>
@@@ -2351,9 -2339,6 +2352,9 @@@ F:      include/drm/i915
  
  DRM DRIVERS FOR EXYNOS
  M:    Inki Dae <inki.dae@samsung.com>
 +M:    Joonyoung Shim <jy0922.shim@samsung.com>
 +M:    Seung-Woo Kim <sw0312.kim@samsung.com>
 +M:    Kyungmin Park <kyungmin.park@samsung.com>
  L:    dri-devel@lists.freedesktop.org
  S:    Supported
  F:    drivers/gpu/drm/exynos
@@@ -2406,7 -2391,7 +2407,7 @@@ F:      net/bridge/netfilter/ebt*.
  
  ECRYPT FILE SYSTEM
  M:    Tyler Hicks <tyhicks@canonical.com>
 -M:    Dustin Kirkland <kirkland@canonical.com>
 +M:    Dustin Kirkland <dustin.kirkland@gazzang.com>
  L:    ecryptfs@vger.kernel.org
  W:    https://launchpad.net/ecryptfs
  S:    Supported
@@@ -2845,14 -2830,6 +2846,14 @@@ L:    platform-driver-x86@vger.kernel.or
  S:    Maintained
  F:    drivers/platform/x86/fujitsu-laptop.c
  
 +FUJITSU M-5MO LS CAMERA ISP DRIVER
 +M:    Kyungmin Park <kyungmin.park@samsung.com>
 +M:    Heungjun Kim <riverful.kim@samsung.com>
 +L:    linux-media@vger.kernel.org
 +S:    Maintained
 +F:    drivers/media/video/m5mols/
 +F:    include/media/m5mols.h
 +
  FUSE: FILESYSTEM IN USERSPACE
  M:    Miklos Szeredi <miklos@szeredi.hu>
  L:    fuse-devel@lists.sourceforge.net
@@@ -3225,7 -3202,6 +3226,7 @@@ F:      drivers/i2c/busses/i2c-stub.
  I2C SUBSYSTEM
  M:    "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
  M:    "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
 +M:    "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de>
  L:    linux-i2c@vger.kernel.org
  W:    http://i2c.wiki.kernel.org/
  T:    quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-i2c/
@@@ -3807,6 -3783,7 +3808,6 @@@ S:      Odd Fixe
  
  KERNEL NFSD, SUNRPC, AND LOCKD SERVERS
  M:    "J. Bruce Fields" <bfields@fieldses.org>
 -M:    Neil Brown <neilb@suse.de>
  L:    linux-nfs@vger.kernel.org
  W:    http://nfs.sourceforge.net/
  S:    Supported
@@@ -4141,7 -4118,6 +4142,7 @@@ F:      fs/partitions/ldm.
  
  LogFS
  M:    Joern Engel <joern@logfs.org>
 +M:    Prasad Joshi <prasadjoshi.linux@gmail.com>
  L:    logfs@logfs.org
  W:    logfs.org
  S:    Maintained
@@@ -4283,6 -4259,13 +4284,6 @@@ S:     Orpha
  F:    drivers/video/matrox/matroxfb_*
  F:    include/linux/matroxfb.h
  
 -MAX1668 TEMPERATURE SENSOR DRIVER
 -M:    "David George" <david.george@ska.ac.za>
 -L:    lm-sensors@lm-sensors.org
 -S:    Maintained
 -F:    Documentation/hwmon/max1668
 -F:    drivers/hwmon/max1668.c
 -
  MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER
  M:    "Hans J. Koch" <hjk@hansjkoch.de>
  L:    lm-sensors@lm-sensors.org
@@@ -4709,8 -4692,6 +4710,8 @@@ Q:      http://patchwork.kernel.org/project/
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
  S:    Maintained
  F:    arch/arm/*omap*/
 +F:    drivers/i2c/busses/i2c-omap.c
 +F:    include/linux/i2c-omap.h
  
  OMAP CLOCK FRAMEWORK SUPPORT
  M:    Paul Walmsley <paul@pwsan.com>
@@@ -5695,12 -5676,6 +5696,12 @@@ L:    alsa-devel@alsa-project.org (moderat
  S:    Supported
  F:    sound/soc/samsung
  
 +SAMSUNG FRAMEBUFFER DRIVER
 +M:    Jingoo Han <jg1.han@samsung.com>
 +L:    linux-fbdev@vger.kernel.org
 +S:    Maintained
 +F:    drivers/video/s3c-fb.c
 +
  SERIAL DRIVERS
  M:    Alan Cox <alan@linux.intel.com>
  L:    linux-serial@vger.kernel.org
@@@ -5864,7 -5839,7 +5865,7 @@@ F:      drivers/mmc/host/sdhci-spear.
  SECURITY SUBSYSTEM
  M:    James Morris <jmorris@namei.org>
  L:    linux-security-module@vger.kernel.org (suggested Cc:)
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6.git
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
  W:    http://security.wiki.kernel.org/
  S:    Supported
  F:    security/
@@@ -5990,7 -5965,6 +5991,7 @@@ L:      davinci-linux-open-source@linux.davi
  Q:    http://patchwork.kernel.org/project/linux-davinci/list/
  S:    Supported
  F:    arch/arm/mach-davinci
 +F:    drivers/i2c/busses/i2c-davinci.c
  
  SIS 190 ETHERNET DRIVER
  M:    Francois Romieu <romieu@fr.zoreil.com>
@@@ -6673,7 -6647,7 +6674,7 @@@ TTY LAYE
  M:    Greg Kroah-Hartman <gregkh@suse.de>
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git
 -F:    drivers/tty/*
 +F:    drivers/tty/
  F:    drivers/tty/serial/serial_core.c
  F:    include/linux/serial_core.h
  F:    include/linux/serial.h
@@@ -7209,7 -7183,7 +7210,7 @@@ S:      Maintaine
  F:    drivers/net/vmxnet3/
  
  VMware PVSCSI driver
 -M:    Alok Kataria <akataria@vmware.com>
 +M:    Arvind Kumar <arvindkumar@vmware.com>
  M:    VMware PV-Drivers <pv-drivers@vmware.com>
  L:    linux-scsi@vger.kernel.org
  S:    Maintained
@@@ -7366,7 -7340,6 +7367,7 @@@ S:      Supporte
  F:    Documentation/hwmon/wm83??
  F:    arch/arm/mach-s3c64xx/mach-crag6410*
  F:    drivers/leds/leds-wm83*.c
 +F:    drivers/hwmon/wm83??-hwmon.c
  F:    drivers/input/misc/wm831x-on.c
  F:    drivers/input/touchscreen/wm831x-ts.c
  F:    drivers/input/touchscreen/wm97*.c
@@@ -7468,12 -7441,6 +7469,12 @@@ S:    Supporte
  F:    Documentation/filesystems/xfs.txt
  F:    fs/xfs/
  
 +XILINX AXI ETHERNET DRIVER
 +M:    Ariane Keller <ariane.keller@tik.ee.ethz.ch>
 +M:    Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
 +S:    Maintained
 +F:    drivers/net/ethernet/xilinx/xilinx_axienet*
 +
  XILINX SYSTEMACE DRIVER
  M:    Grant Likely <grant.likely@secretlab.ca>
  W:    http://www.secretlab.ca/
@@@ -116,10 -116,8 +116,10 @@@ MODULE_PARM_DESC(pio, "Use PIO accesse
  #ifdef CONFIG_B43_BCMA
  static const struct bcma_device_id b43_bcma_tbl[] = {
        BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS),
 +#ifdef CONFIG_B43_BCMA_EXTRA
        BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS),
        BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS),
 +#endif
        BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1D, BCMA_ANY_CLASS),
        BCMA_CORETABLE_END
  };
@@@ -580,22 -578,14 +580,14 @@@ void b43_tsf_read(struct b43_wldev *dev
  
  static void b43_time_lock(struct b43_wldev *dev)
  {
-       u32 macctl;
-       macctl = b43_read32(dev, B43_MMIO_MACCTL);
-       macctl |= B43_MACCTL_TBTTHOLD;
-       b43_write32(dev, B43_MMIO_MACCTL, macctl);
+       b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_TBTTHOLD);
        /* Commit the write */
        b43_read32(dev, B43_MMIO_MACCTL);
  }
  
  static void b43_time_unlock(struct b43_wldev *dev)
  {
-       u32 macctl;
-       macctl = b43_read32(dev, B43_MMIO_MACCTL);
-       macctl &= ~B43_MACCTL_TBTTHOLD;
-       b43_write32(dev, B43_MMIO_MACCTL, macctl);
+       b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_TBTTHOLD, 0);
        /* Commit the write */
        b43_read32(dev, B43_MMIO_MACCTL);
  }
@@@ -2487,10 -2477,8 +2479,8 @@@ static int b43_upload_microcode(struct 
        b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, B43_IRQ_ALL);
  
        /* Start the microcode PSM */
-       macctl = b43_read32(dev, B43_MMIO_MACCTL);
-       macctl &= ~B43_MACCTL_PSM_JMP0;
-       macctl |= B43_MACCTL_PSM_RUN;
-       b43_write32(dev, B43_MMIO_MACCTL, macctl);
+       b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_JMP0,
+                     B43_MACCTL_PSM_RUN);
  
        /* Wait for the microcode to load and respond */
        i = 0;
        return 0;
  
  error:
-       macctl = b43_read32(dev, B43_MMIO_MACCTL);
-       macctl &= ~B43_MACCTL_PSM_RUN;
-       macctl |= B43_MACCTL_PSM_JMP0;
-       b43_write32(dev, B43_MMIO_MACCTL, macctl);
+       /* Stop the microcode PSM. */
+       b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN,
+                     B43_MACCTL_PSM_JMP0);
  
        return err;
  }
@@@ -2708,11 -2695,8 +2697,8 @@@ static int b43_gpio_init(struct b43_wld
        struct ssb_device *gpiodev;
        u32 mask, set;
  
-       b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL)
-                   & ~B43_MACCTL_GPOUTSMSK);
-       b43_write16(dev, B43_MMIO_GPIO_MASK, b43_read16(dev, B43_MMIO_GPIO_MASK)
-                   | 0x000F);
+       b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_GPOUTSMSK, 0);
+       b43_maskset16(dev, B43_MMIO_GPIO_MASK, ~0, 0xF);
  
        mask = 0x0000001F;
        set = 0x0000000F;
@@@ -2800,9 -2784,7 +2786,7 @@@ void b43_mac_enable(struct b43_wldev *d
        dev->mac_suspended--;
        B43_WARN_ON(dev->mac_suspended < 0);
        if (dev->mac_suspended == 0) {
-               b43_write32(dev, B43_MMIO_MACCTL,
-                           b43_read32(dev, B43_MMIO_MACCTL)
-                           | B43_MACCTL_ENABLED);
+               b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_ENABLED);
                b43_write32(dev, B43_MMIO_GEN_IRQ_REASON,
                            B43_IRQ_MAC_SUSPENDED);
                /* Commit writes */
@@@ -2823,9 -2805,7 +2807,7 @@@ void b43_mac_suspend(struct b43_wldev *
  
        if (dev->mac_suspended == 0) {
                b43_power_saving_ctl_bits(dev, B43_PS_AWAKE);
-               b43_write32(dev, B43_MMIO_MACCTL,
-                           b43_read32(dev, B43_MMIO_MACCTL)
-                           & ~B43_MACCTL_ENABLED);
+               b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_ENABLED, 0);
                /* force pci to flush the write */
                b43_read32(dev, B43_MMIO_MACCTL);
                for (i = 35; i; i--) {
@@@ -2931,15 -2911,10 +2913,10 @@@ static void b43_adjust_opmode(struct b4
         *        so always disable it. If we want to implement PMQ,
         *        we need to enable it here (clear DISCPMQ) in AP mode.
         */
-       if (0  /* ctl & B43_MACCTL_AP */) {
-               b43_write32(dev, B43_MMIO_MACCTL,
-                           b43_read32(dev, B43_MMIO_MACCTL)
-                           & ~B43_MACCTL_DISCPMQ);
-       } else {
-               b43_write32(dev, B43_MMIO_MACCTL,
-                           b43_read32(dev, B43_MMIO_MACCTL)
-                           | B43_MACCTL_DISCPMQ);
-       }
+       if (0  /* ctl & B43_MACCTL_AP */)
+               b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_DISCPMQ, 0);
+       else
+               b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_DISCPMQ);
  }
  
  static void b43_rate_memory_write(struct b43_wldev *dev, u16 rate, int is_ofdm)
@@@ -3083,10 -3058,8 +3060,8 @@@ static int b43_chip_init(struct b43_wld
        if (dev->dev->core_rev < 5)
                b43_write32(dev, 0x010C, 0x01000000);
  
-       b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL)
-                   & ~B43_MACCTL_INFRA);
-       b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL)
-                   | B43_MACCTL_INFRA);
+       b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_INFRA, 0);
+       b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_INFRA);
  
        /* Probe Response Timeout value */
        /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */
@@@ -4564,8 -4537,6 +4539,6 @@@ static void b43_set_pretbtt(struct b43_
  /* Locking: wl->mutex */
  static void b43_wireless_core_exit(struct b43_wldev *dev)
  {
-       u32 macctl;
        B43_WARN_ON(dev && b43_status(dev) > B43_STAT_INITIALIZED);
        if (!dev || b43_status(dev) != B43_STAT_INITIALIZED)
                return;
        b43_set_status(dev, B43_STAT_UNINIT);
  
        /* Stop the microcode PSM. */
-       macctl = b43_read32(dev, B43_MMIO_MACCTL);
-       macctl &= ~B43_MACCTL_PSM_RUN;
-       macctl |= B43_MACCTL_PSM_JMP0;
-       b43_write32(dev, B43_MMIO_MACCTL, macctl);
+       b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PSM_RUN,
+                     B43_MACCTL_PSM_JMP0);
  
        b43_dma_free(dev);
        b43_pio_free(dev);
@@@ -14,6 -14,8 +14,8 @@@
   * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   */
  
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  #include <linux/pci_ids.h>
  #include <linux/if_ether.h>
  #include <net/mac80211.h>
@@@ -293,11 -295,11 +295,11 @@@ const u8 prio2fifo[NUMPRIO] = 
  
  /* debug/trace */
  uint brcm_msg_level =
- #if defined(BCMDBG)
+ #if defined(DEBUG)
        LOG_ERROR_VAL;
  #else
        0;
- #endif                                /* BCMDBG */
+ #endif                                /* DEBUG */
  
  /* TX FIFO number to WME/802.1E Access Category */
  static const u8 wme_fifo2ac[] = {
@@@ -342,14 -344,14 +344,14 @@@ static const u16 xmtfifo_sz[][NFIFO] = 
        {9, 58, 22, 14, 14, 5},
  };
  
- #ifdef BCMDBG
+ #ifdef DEBUG
  static const char * const fifo_names[] = {
        "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
  #else
  static const char fifo_names[6][0];
  #endif
  
- #ifdef BCMDBG
+ #ifdef DEBUG
  /* pointer to most recently allocated wl/wlc */
  static struct brcms_c_info *wlc_info_dbg = (struct brcms_c_info *) (NULL);
  #endif
@@@ -3075,30 -3077,30 +3077,30 @@@ static void brcms_c_statsupd(struct brc
  {
        int i;
        struct macstat macstats;
- #ifdef BCMDBG
+ #ifdef DEBUG
        u16 delta;
        u16 rxf0ovfl;
        u16 txfunfl[NFIFO];
- #endif                                /* BCMDBG */
+ #endif                                /* DEBUG */
  
        /* if driver down, make no sense to update stats */
        if (!wlc->pub->up)
                return;
  
- #ifdef BCMDBG
+ #ifdef DEBUG
        /* save last rx fifo 0 overflow count */
        rxf0ovfl = wlc->core->macstat_snapshot->rxf0ovfl;
  
        /* save last tx fifo  underflow count */
        for (i = 0; i < NFIFO; i++)
                txfunfl[i] = wlc->core->macstat_snapshot->txfunfl[i];
- #endif                                /* BCMDBG */
+ #endif                                /* DEBUG */
  
        /* Read mac stats from contiguous shared memory */
        brcms_b_copyfrom_objmem(wlc->hw, M_UCODE_MACSTAT, &macstats,
                                sizeof(struct macstat), OBJADDR_SHM_SEL);
  
- #ifdef BCMDBG
+ #ifdef DEBUG
        /* check for rx fifo 0 overflow */
        delta = (u16) (wlc->core->macstat_snapshot->rxf0ovfl - rxf0ovfl);
        if (delta)
                        wiphy_err(wlc->wiphy, "wl%d: %u tx fifo %d underflows!"
                                  "\n", wlc->pub->unit, delta, i);
        }
- #endif                                /* BCMDBG */
+ #endif                                /* DEBUG */
  
        /* merge counters from dma module */
        for (i = 0; i < NFIFO; i++) {
@@@ -5765,62 -5767,49 +5767,49 @@@ int brcms_c_module_unregister(struct br
        return -ENODATA;
  }
  
- #ifdef BCMDBG
- static const char * const supr_reason[] = {
-       "None", "PMQ Entry", "Flush request",
-       "Previous frag failure", "Channel mismatch",
-       "Lifetime Expiry", "Underflow"
- };
- static void brcms_c_print_txs_status(u16 s)
- {
-       printk(KERN_DEBUG "[15:12]  %d  frame attempts\n",
-              (s & TX_STATUS_FRM_RTX_MASK) >> TX_STATUS_FRM_RTX_SHIFT);
-       printk(KERN_DEBUG " [11:8]  %d  rts attempts\n",
-              (s & TX_STATUS_RTS_RTX_MASK) >> TX_STATUS_RTS_RTX_SHIFT);
-       printk(KERN_DEBUG "    [7]  %d  PM mode indicated\n",
-              ((s & TX_STATUS_PMINDCTD) ? 1 : 0));
-       printk(KERN_DEBUG "    [6]  %d  intermediate status\n",
-              ((s & TX_STATUS_INTERMEDIATE) ? 1 : 0));
-       printk(KERN_DEBUG "    [5]  %d  AMPDU\n",
-              (s & TX_STATUS_AMPDU) ? 1 : 0);
-       printk(KERN_DEBUG "  [4:2]  %d  Frame Suppressed Reason (%s)\n",
-              ((s & TX_STATUS_SUPR_MASK) >> TX_STATUS_SUPR_SHIFT),
-              supr_reason[(s & TX_STATUS_SUPR_MASK) >> TX_STATUS_SUPR_SHIFT]);
-       printk(KERN_DEBUG "    [1]  %d  acked\n",
-              ((s & TX_STATUS_ACK_RCV) ? 1 : 0));
- }
- #endif                                /* BCMDBG */
  void brcms_c_print_txstatus(struct tx_status *txs)
  {
- #if defined(BCMDBG)
-       u16 s = txs->status;
-       u16 ackphyrxsh = txs->ackphyrxsh;
-       printk(KERN_DEBUG "\ntxpkt (MPDU) Complete\n");
-       printk(KERN_DEBUG "FrameID: %04x   ", txs->frameid);
-       printk(KERN_DEBUG "TxStatus: %04x", s);
-       printk(KERN_DEBUG "\n");
-       brcms_c_print_txs_status(s);
-       printk(KERN_DEBUG "LastTxTime: %04x ", txs->lasttxtime);
-       printk(KERN_DEBUG "Seq: %04x ", txs->sequence);
-       printk(KERN_DEBUG "PHYTxStatus: %04x ", txs->phyerr);
-       printk(KERN_DEBUG "RxAckRSSI: %04x ",
-              (ackphyrxsh & PRXS1_JSSI_MASK) >> PRXS1_JSSI_SHIFT);
-       printk(KERN_DEBUG "RxAckSQ: %04x",
-              (ackphyrxsh & PRXS1_SQ_MASK) >> PRXS1_SQ_SHIFT);
-       printk(KERN_DEBUG "\n");
- #endif                                /* defined(BCMDBG) */
+       pr_debug("\ntxpkt (MPDU) Complete\n");
+       pr_debug("FrameID: %04x   TxStatus: %04x\n", txs->frameid, txs->status);
+       pr_debug("[15:12]  %d  frame attempts\n",
+                 (txs->status & TX_STATUS_FRM_RTX_MASK) >>
+                TX_STATUS_FRM_RTX_SHIFT);
+       pr_debug(" [11:8]  %d  rts attempts\n",
+                (txs->status & TX_STATUS_RTS_RTX_MASK) >>
+                TX_STATUS_RTS_RTX_SHIFT);
+       pr_debug("    [7]  %d  PM mode indicated\n",
+                txs->status & TX_STATUS_PMINDCTD ? 1 : 0);
+       pr_debug("    [6]  %d  intermediate status\n",
+                txs->status & TX_STATUS_INTERMEDIATE ? 1 : 0);
+       pr_debug("    [5]  %d  AMPDU\n",
+                txs->status & TX_STATUS_AMPDU ? 1 : 0);
+       pr_debug("  [4:2]  %d  Frame Suppressed Reason (%s)\n",
+                (txs->status & TX_STATUS_SUPR_MASK) >> TX_STATUS_SUPR_SHIFT,
+                (const char *[]) {
+                       "None",
+                       "PMQ Entry",
+                       "Flush request",
+                       "Previous frag failure",
+                       "Channel mismatch",
+                       "Lifetime Expiry",
+                       "Underflow"
+                } [(txs->status & TX_STATUS_SUPR_MASK) >>
+                   TX_STATUS_SUPR_SHIFT]);
+       pr_debug("    [1]  %d  acked\n",
+                txs->status & TX_STATUS_ACK_RCV ? 1 : 0);
+       pr_debug("LastTxTime: %04x Seq: %04x PHYTxStatus: %04x RxAckRSSI: %04x RxAckSQ: %04x\n",
+                txs->lasttxtime, txs->sequence, txs->phyerr,
+                (txs->ackphyrxsh & PRXS1_JSSI_MASK) >> PRXS1_JSSI_SHIFT,
+                (txs->ackphyrxsh & PRXS1_SQ_MASK) >> PRXS1_SQ_SHIFT);
  }
  
  bool brcms_c_chipmatch(u16 vendor, u16 device)
  {
        if (vendor != PCI_VENDOR_ID_BROADCOM) {
-               pr_err("chipmatch: unknown vendor id %04x\n", vendor);
+               pr_err("unknown vendor id %04x\n", vendor);
                return false;
        }
  
        if ((device == BCM43236_D11N_ID) || (device == BCM43236_D11N2G_ID))
                return true;
  
-       pr_err("chipmatch: unknown device id %04x\n", device);
+       pr_err("unknown device id %04x\n", device);
        return false;
  }
  
- #if defined(BCMDBG)
+ #if defined(DEBUG)
  void brcms_c_print_txdesc(struct d11txh *txh)
  {
        u16 mtcl = le16_to_cpu(txh->MacTxControlLow);
        struct ieee80211_rts rts = txh->rts_frame;
  
        /* add plcp header along with txh descriptor */
-       printk(KERN_DEBUG "Raw TxDesc + plcp header:\n");
-       print_hex_dump_bytes("", DUMP_PREFIX_OFFSET,
-                            txh, sizeof(struct d11txh) + 48);
-       printk(KERN_DEBUG "TxCtlLow: %04x ", mtcl);
-       printk(KERN_DEBUG "TxCtlHigh: %04x ", mtch);
-       printk(KERN_DEBUG "FC: %04x ", mfc);
-       printk(KERN_DEBUG "FES Time: %04x\n", tfest);
-       printk(KERN_DEBUG "PhyCtl: %04x%s ", ptcw,
+       brcmu_dbg_hex_dump(txh, sizeof(struct d11txh) + 48,
+                          "Raw TxDesc + plcp header:\n");
+       pr_debug("TxCtlLow: %04x ", mtcl);
+       pr_debug("TxCtlHigh: %04x ", mtch);
+       pr_debug("FC: %04x ", mfc);
+       pr_debug("FES Time: %04x\n", tfest);
+       pr_debug("PhyCtl: %04x%s ", ptcw,
               (ptcw & PHY_TXC_SHORT_HDR) ? " short" : "");
-       printk(KERN_DEBUG "PhyCtl_1: %04x ", ptcw_1);
-       printk(KERN_DEBUG "PhyCtl_1_Fbr: %04x\n", ptcw_1_Fbr);
-       printk(KERN_DEBUG "PhyCtl_1_Rts: %04x ", ptcw_1_Rts);
-       printk(KERN_DEBUG "PhyCtl_1_Fbr_Rts: %04x\n", ptcw_1_FbrRts);
-       printk(KERN_DEBUG "MainRates: %04x ", mainrates);
-       printk(KERN_DEBUG "XtraFrameTypes: %04x ", xtraft);
-       printk(KERN_DEBUG "\n");
+       pr_debug("PhyCtl_1: %04x ", ptcw_1);
+       pr_debug("PhyCtl_1_Fbr: %04x\n", ptcw_1_Fbr);
+       pr_debug("PhyCtl_1_Rts: %04x ", ptcw_1_Rts);
+       pr_debug("PhyCtl_1_Fbr_Rts: %04x\n", ptcw_1_FbrRts);
+       pr_debug("MainRates: %04x ", mainrates);
+       pr_debug("XtraFrameTypes: %04x ", xtraft);
+       pr_debug("\n");
  
        print_hex_dump_bytes("SecIV:", DUMP_PREFIX_OFFSET, iv, sizeof(txh->IV));
        print_hex_dump_bytes("RA:", DUMP_PREFIX_OFFSET,
                             ra, sizeof(txh->TxFrameRA));
  
-       printk(KERN_DEBUG "Fb FES Time: %04x ", tfestfb);
+       pr_debug("Fb FES Time: %04x ", tfestfb);
        print_hex_dump_bytes("Fb RTS PLCP:", DUMP_PREFIX_OFFSET,
                             rtspfb, sizeof(txh->RTSPLCPFallback));
-       printk(KERN_DEBUG "RTS DUR: %04x ", rtsdfb);
+       pr_debug("RTS DUR: %04x ", rtsdfb);
        print_hex_dump_bytes("PLCP:", DUMP_PREFIX_OFFSET,
                             fragpfb, sizeof(txh->FragPLCPFallback));
-       printk(KERN_DEBUG "DUR: %04x", fragdfb);
-       printk(KERN_DEBUG "\n");
+       pr_debug("DUR: %04x", fragdfb);
+       pr_debug("\n");
  
-       printk(KERN_DEBUG "MModeLen: %04x ", mmodelen);
-       printk(KERN_DEBUG "MModeFbrLen: %04x\n", mmodefbrlen);
+       pr_debug("MModeLen: %04x ", mmodelen);
+       pr_debug("MModeFbrLen: %04x\n", mmodefbrlen);
  
-       printk(KERN_DEBUG "FrameID:     %04x\n", tfid);
-       printk(KERN_DEBUG "TxStatus:    %04x\n", txs);
+       pr_debug("FrameID:     %04x\n", tfid);
+       pr_debug("TxStatus:    %04x\n", txs);
  
-       printk(KERN_DEBUG "MaxNumMpdu:  %04x\n", mnmpdu);
-       printk(KERN_DEBUG "MaxAggbyte:  %04x\n", mabyte);
-       printk(KERN_DEBUG "MaxAggbyte_fb:  %04x\n", mabyte_f);
-       printk(KERN_DEBUG "MinByte:     %04x\n", mmbyte);
+       pr_debug("MaxNumMpdu:  %04x\n", mnmpdu);
+       pr_debug("MaxAggbyte:  %04x\n", mabyte);
+       pr_debug("MaxAggbyte_fb:  %04x\n", mabyte_f);
+       pr_debug("MinByte:     %04x\n", mmbyte);
  
        print_hex_dump_bytes("RTS PLCP:", DUMP_PREFIX_OFFSET,
                             rtsph, sizeof(txh->RTSPhyHeader));
        print_hex_dump_bytes("RTS Frame:", DUMP_PREFIX_OFFSET,
                             (u8 *)&rts, sizeof(txh->rts_frame));
-       printk(KERN_DEBUG "\n");
+       pr_debug("\n");
  }
- #endif                                /* defined(BCMDBG) */
+ #endif                                /* defined(DEBUG) */
  
- #if defined(BCMDBG)
+ #if defined(DEBUG)
  static int
  brcms_c_format_flags(const struct brcms_c_bit_desc *bd, u32 flags, char *buf,
                     int len)
  
        return (int)(p - buf);
  }
- #endif                                /* defined(BCMDBG) */
+ #endif                                /* defined(DEBUG) */
  
- #if defined(BCMDBG)
+ #if defined(DEBUG)
  void brcms_c_print_rxh(struct d11rxhdr *rxh)
  {
        u16 len = rxh->RxFrameSize;
                {0, NULL}
        };
  
-       printk(KERN_DEBUG "Raw RxDesc:\n");
-       print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, rxh,
-                            sizeof(struct d11rxhdr));
+       brcmu_dbg_hex_dump(rxh, sizeof(struct d11rxhdr), "Raw RxDesc:\n");
  
        brcms_c_format_flags(macstat_flags, macstatus1, flagstr, 64);
  
        snprintf(lenbuf, sizeof(lenbuf), "0x%x", len);
  
-       printk(KERN_DEBUG "RxFrameSize:     %6s (%d)%s\n", lenbuf, len,
+       pr_debug("RxFrameSize:     %6s (%d)%s\n", lenbuf, len,
               (rxh->PhyRxStatus_0 & PRXS0_SHORTH) ? " short preamble" : "");
-       printk(KERN_DEBUG "RxPHYStatus:     %04x %04x %04x %04x\n",
+       pr_debug("RxPHYStatus:     %04x %04x %04x %04x\n",
               phystatus_0, phystatus_1, phystatus_2, phystatus_3);
-       printk(KERN_DEBUG "RxMACStatus:     %x %s\n", macstatus1, flagstr);
-       printk(KERN_DEBUG "RXMACaggtype:    %x\n",
+       pr_debug("RxMACStatus:     %x %s\n", macstatus1, flagstr);
+       pr_debug("RXMACaggtype:    %x\n",
               (macstatus2 & RXS_AGGTYPE_MASK));
-       printk(KERN_DEBUG "RxTSFTime:       %04x\n", rxh->RxTSFTime);
+       pr_debug("RxTSFTime:       %04x\n", rxh->RxTSFTime);
  }
- #endif                                /* defined(BCMDBG) */
+ #endif                                /* defined(DEBUG) */
  
  u16 brcms_b_rate_shm_offset(struct brcms_hardware *wlc_hw, u8 rate)
  {
@@@ -7981,21 -7967,13 +7967,21 @@@ int brcms_c_get_curband(struct brcms_c_
  
  void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop)
  {
 +      int timeout = 20;
 +
        /* flush packet queue when requested */
        if (drop)
                brcmu_pktq_flush(&wlc->pkt_queue->q, false, NULL, NULL);
  
        /* wait for queue and DMA fifos to run dry */
 -      while (!pktq_empty(&wlc->pkt_queue->q) || brcms_txpktpendtot(wlc) > 0)
 +      while (!pktq_empty(&wlc->pkt_queue->q) || brcms_txpktpendtot(wlc) > 0) {
                brcms_msleep(wlc->wl, 1);
 +
 +              if (--timeout == 0)
 +                      break;
 +      }
 +
 +      WARN_ON_ONCE(timeout == 0);
  }
  
  void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval)
@@@ -8354,7 -8332,7 +8340,7 @@@ brcms_c_attach(struct brcms_info *wl, s
        wlc->wiphy = wl->wiphy;
        pub = wlc->pub;
  
- #if defined(BCMDBG)
+ #if defined(DEBUG)
        wlc_info_dbg = wlc;
  #endif
  
@@@ -2,7 -2,7 +2,7 @@@
   *
   * GPL LICENSE SUMMARY
   *
-  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
+  * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of version 2 of the GNU General Public License as
@@@ -91,7 -91,6 +91,7 @@@ static void iwlagn_tx_cmd_build_basic(s
                tx_cmd->tid_tspec = qc[0] & 0xf;
                tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
        } else {
 +              tx_cmd->tid_tspec = IWL_TID_NON_QOS;
                if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)
                        tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
                else
@@@ -621,7 -620,7 +621,7 @@@ int iwlagn_tx_agg_oper(struct iwl_priv 
        sta_priv->lq_sta.lq.agg_params.agg_frame_cnt_limit =
                sta_priv->max_agg_bufsize;
  
 -      IWL_INFO(priv, "Tx aggregation enabled on ra = %pM tid = %d\n",
 +      IWL_DEBUG_HT(priv, "Tx aggregation enabled on ra = %pM tid = %d\n",
                 sta->addr, tid);
  
        return iwl_send_lq_cmd(priv, ctx,
@@@ -809,8 -808,6 +809,8 @@@ static void iwl_rx_reply_tx_agg(struct 
        u32 status = le16_to_cpu(tx_resp->status.status);
        int i;
  
 +      WARN_ON(tid == IWL_TID_NON_QOS);
 +
        if (agg->wait_for_ba)
                IWL_DEBUG_TX_REPLY(priv,
                        "got tx response w/o block-ack\n");
@@@ -1038,13 -1035,10 +1038,13 @@@ int iwlagn_rx_reply_tx(struct iwl_priv 
                }
  
                __skb_queue_head_init(&skbs);
 -              priv->tid_data[sta_id][tid].next_reclaimed = next_reclaimed;
  
 -              IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d",
 -                                        next_reclaimed);
 +              if (tid != IWL_TID_NON_QOS) {
 +                      priv->tid_data[sta_id][tid].next_reclaimed =
 +                              next_reclaimed;
 +                      IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d",
 +                                                next_reclaimed);
 +              }
  
                /*we can free until ssn % q.n_bd not inclusive */
                WARN_ON(iwl_trans_reclaim(trans(priv), sta_id, tid, txq_id,
@@@ -5,7 -5,7 +5,7 @@@
   *
   * GPL LICENSE SUMMARY
   *
-  * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
+  * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of version 2 of the GNU General Public License as
@@@ -30,7 -30,7 +30,7 @@@
   *
   * BSD LICENSE
   *
-  * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
+  * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
@@@ -815,7 -815,6 +815,7 @@@ struct iwl_qosparam_cmd 
  
  #define       IWL_INVALID_STATION     255
  #define IWL_MAX_TID_COUNT     8
 +#define IWL_TID_NON_QOS IWL_MAX_TID_COUNT
  
  #define STA_FLG_TX_RATE_MSK           cpu_to_le32(1 << 2)
  #define STA_FLG_PWR_SAVE_MSK          cpu_to_le32(1 << 8)
@@@ -1,6 -1,6 +1,6 @@@
  /******************************************************************************
   *
-  * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
+  * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
   *
   * Portions of this file are derived from the ipw3945 project, as well
   * as portions of the ieee80211 subsystem header files.
@@@ -972,11 -972,11 +972,11 @@@ void iwl_irq_tasklet(struct iwl_trans *
        }
  #endif
  
 -      spin_unlock_irqrestore(&trans->shrd->lock, flags);
 -
        /* saved interrupt in inta variable now we can reset trans_pcie->inta */
        trans_pcie->inta = 0;
  
 +      spin_unlock_irqrestore(&trans->shrd->lock, flags);
 +
        /* Now service all interrupt bits discovered above. */
        if (inta & CSR_INT_BIT_HW_ERR) {
                IWL_ERR(trans, "Hardware error detected.  Restarting.\n");
@@@ -5,7 -5,7 +5,7 @@@
   *
   * GPL LICENSE SUMMARY
   *
-  * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved.
+  * Copyright(c) 2007 - 2012 Intel Corporation. All rights reserved.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of version 2 of the GNU General Public License as
@@@ -30,7 -30,7 +30,7 @@@
   *
   * BSD LICENSE
   *
-  * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
+  * Copyright(c) 2005 - 2012 Intel Corporation. All rights reserved.
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
@@@ -1262,7 -1262,6 +1262,7 @@@ static int iwl_trans_pcie_reclaim(struc
        txq->time_stamp = jiffies;
  
        if (unlikely(txq_id >= IWLAGN_FIRST_AMPDU_QUEUE &&
 +                   tid != IWL_TID_NON_QOS &&
                     txq_id != trans_pcie->agg_txq[sta_id][tid])) {
                /*
                 * FIXME: this is a uCode bug which need to be addressed,
@@@ -412,18 -412,6 +412,6 @@@ int rt2800_load_firmware(struct rt2x00_
        }
  
        /*
-        * Disable DMA, will be reenabled later when enabling
-        * the radio.
-        */
-       rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
-       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
-       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_DMA_BUSY, 0);
-       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
-       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_RX_DMA_BUSY, 0);
-       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_TX_WRITEBACK_DONE, 1);
-       rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
-       /*
         * Write firmware to the device.
         */
        rt2800_drv_write_firmware(rt2x00dev, data, len);
        }
  
        /*
+        * Disable DMA, will be reenabled later when enabling
+        * the radio.
+        */
+       rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
+       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_TX_DMA, 0);
+       rt2x00_set_field32(&reg, WPDMA_GLO_CFG_ENABLE_RX_DMA, 0);
+       rt2800_register_write(rt2x00dev, WPDMA_GLO_CFG, reg);
+       /*
         * Initialize firmware.
         */
        rt2800_register_write(rt2x00dev, H2M_BBP_AGENT, 0);
        rt2800_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0);
+       if (rt2x00_is_usb(rt2x00dev))
+               rt2800_register_write(rt2x00dev, H2M_INT_SRC, 0);
        msleep(1);
  
        return 0;
@@@ -514,9 -513,9 +513,9 @@@ EXPORT_SYMBOL_GPL(rt2800_write_tx_data)
  
  static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2)
  {
 -      int rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0);
 -      int rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1);
 -      int rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2);
 +      s8 rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0);
 +      s8 rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1);
 +      s8 rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2);
        u16 eeprom;
        u8 offset0;
        u8 offset1;
         * which gives less energy...
         */
        rssi0 = max(rssi0, rssi1);
 -      return max(rssi0, rssi2);
 +      return (int)max(rssi0, rssi2);
  }
  
  void rt2800_process_rxwi(struct queue_entry *entry,
@@@ -1,6 -1,6 +1,6 @@@
  /******************************************************************************
   *
-  * Copyright(c) 2009-2010  Realtek Corporation.
+  * Copyright(c) 2009-2012  Realtek Corporation.
   *
   * This program is free software; you can redistribute it and/or modify it
   * under the terms of version 2 of the GNU General Public License as
   *
   *****************************************************************************/
  
- #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
- #include <linux/vmalloc.h>
- #include <linux/module.h>
  #include "../wifi.h"
  #include "../core.h"
  #include "../pci.h"
+ #include "../base.h"
+ #include "../pci.h"
  #include "reg.h"
  #include "def.h"
  #include "phy.h"
@@@ -45,6 -42,8 +42,8 @@@
  #include "trx.h"
  #include "led.h"
  
+ #include <linux/module.h>
  static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw)
  {
        struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
        rtlpci->const_support_pciaspm = 2;
  }
  
+ static void rtl92se_fw_cb(const struct firmware *firmware, void *context)
+ {
+       struct ieee80211_hw *hw = context;
+       struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
+       struct rtl_priv *rtlpriv = rtl_priv(hw);
+       struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
+       struct rt_firmware *pfirmware = NULL;
+       int err;
+       RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD,
+                        "Firmware callback routine entered!\n");
+       complete(&rtlpriv->firmware_loading_complete);
+       if (!firmware) {
+               pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
+               rtlpriv->max_fw_size = 0;
+               return;
+       }
+       if (firmware->size > rtlpriv->max_fw_size) {
+               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
+                        "Firmware is too big!\n");
+               release_firmware(firmware);
+               return;
+       }
+       pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware;
+       memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size);
+       pfirmware->sz_fw_tmpbufferlen = firmware->size;
+       release_firmware(firmware);
+       err = ieee80211_register_hw(hw);
+       if (err) {
+               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
+                        "Can't register mac80211 hw\n");
+               return;
+       } else {
+               rtlpriv->mac80211.mac80211_registered = 1;
+       }
+       rtlpci->irq_alloc = 1;
+       set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
+       /*init rfkill */
+       rtl_init_rfkill(hw);
+ }
  static int rtl92s_init_sw_vars(struct ieee80211_hw *hw)
  {
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
-       const struct firmware *firmware;
-       struct rt_firmware *pfirmware = NULL;
        int err = 0;
        u16 earlyrxthreshold = 7;
  
        rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
        rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
        if (!rtlpriv->psc.inactiveps)
-               pr_info("rtl8192ce: Power Save off (module option)\n");
+               pr_info("Power Save off (module option)\n");
        if (!rtlpriv->psc.fwctrl_lps)
-               pr_info("rtl8192ce: FW Power Save off (module option)\n");
+               pr_info("FW Power Save off (module option)\n");
        rtlpriv->psc.reg_fwctrl_lps = 3;
        rtlpriv->psc.reg_max_lps_awakeintvl = 5;
        /* for ASPM, you can close aspm through
  
        /* for firmware buf */
        rtlpriv->rtlhal.pfirmware = vzalloc(sizeof(struct rt_firmware));
 -      if (!rtlpriv->rtlhal.pfirmware) {
 -              RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
 -                       "Can't alloc buffer for fw\n");
 +      if (!rtlpriv->rtlhal.pfirmware)
                return 1;
 -      }
  
+       rtlpriv->max_fw_size = sizeof(struct rt_firmware);
        pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n"
                "Loading firmware %s\n", rtlpriv->cfg->fw_name);
        /* request fw */
-       err = request_firmware(&firmware, rtlpriv->cfg->fw_name,
-                       rtlpriv->io.dev);
+       err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
+                                     rtlpriv->io.dev, GFP_KERNEL, hw,
+                                     rtl92se_fw_cb);
        if (err) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-                        ("Failed to request firmware!\n"));
+                        "Failed to request firmware!\n");
                return 1;
        }
-       if (firmware->size > sizeof(struct rt_firmware)) {
-               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
-                        ("Firmware is too big!\n"));
-               release_firmware(firmware);
-               return 1;
-       }
-       pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware;
-       memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size);
-       pfirmware->sz_fw_tmpbufferlen = firmware->size;
-       release_firmware(firmware);
  
        return err;
  }
@@@ -423,7 -458,7 +455,7 @@@ static int __init rtl92se_module_init(v
  
        ret = pci_register_driver(&rtl92se_driver);
        if (ret)
-               RT_ASSERT(false, (": No device found\n"));
+               RT_ASSERT(false, "No device found\n");
  
        return ret;
  }
diff --combined net/mac80211/ibss.c
  #define IEEE80211_IBSS_MAX_STA_ENTRIES 128
  
  
- static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
-                                       struct ieee80211_mgmt *mgmt,
-                                       size_t len)
- {
-       u16 auth_alg, auth_transaction;
-       lockdep_assert_held(&sdata->u.ibss.mtx);
-       if (len < 24 + 6)
-               return;
-       auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
-       auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
-       /*
-        * IEEE 802.11 standard does not require authentication in IBSS
-        * networks and most implementations do not seem to use it.
-        * However, try to reply to authentication attempts if someone
-        * has actually implemented this.
-        */
-       if (auth_alg == WLAN_AUTH_OPEN && auth_transaction == 1)
-               ieee80211_send_auth(sdata, 2, WLAN_AUTH_OPEN, NULL, 0,
-                                   sdata->u.ibss.bssid, NULL, 0, 0);
- }
  static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
                                      const u8 *bssid, const int beacon_int,
                                      struct ieee80211_channel *chan,
  
        sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
  
 +      local->oper_channel = chan;
        channel_type = ifibss->channel_type;
        if (channel_type > NL80211_CHAN_HT20 &&
            !cfg80211_can_beacon_sec_chan(local->hw.wiphy, chan, channel_type))
@@@ -276,7 -250,8 +251,8 @@@ static void ieee80211_sta_join_ibss(str
                                  cbss->tsf);
  }
  
- static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta)
+ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta,
+                                                 bool auth)
        __acquires(RCU)
  {
        struct ieee80211_sub_if_data *sdata = sta->sdata;
                    addr, sdata->name);
  #endif
  
-       sta_info_move_state(sta, IEEE80211_STA_AUTH);
-       sta_info_move_state(sta, IEEE80211_STA_ASSOC);
-       sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
+       sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
+       sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
+       sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
  
        rate_control_rate_init(sta);
  
        /* If it fails, maybe we raced another insertion? */
        if (sta_info_insert_rcu(sta))
                return sta_info_get(sdata, addr);
+       if (auth) {
+ #ifdef CONFIG_MAC80211_IBSS_DEBUG
+               printk(KERN_DEBUG "TX Auth SA=%pM DA=%pM BSSID=%pM"
+                      "(auth_transaction=1)\n", sdata->vif.addr,
+                      sdata->u.ibss.bssid, addr);
+ #endif
+               ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0,
+                                   addr, sdata->u.ibss.bssid, NULL, 0, 0);
+       }
        return sta;
  }
  
  static struct sta_info *
  ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
                       const u8 *bssid, const u8 *addr,
-                      u32 supp_rates)
+                      u32 supp_rates, bool auth)
        __acquires(RCU)
  {
        struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
        sta->sta.supp_rates[band] = supp_rates |
                        ieee80211_mandatory_rates(local, band);
  
-       return ieee80211_ibss_finish_sta(sta);
+       return ieee80211_ibss_finish_sta(sta, auth);
+ }
+ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
+                                       struct ieee80211_mgmt *mgmt,
+                                       size_t len)
+ {
+       u16 auth_alg, auth_transaction;
+       lockdep_assert_held(&sdata->u.ibss.mtx);
+       if (len < 24 + 6)
+               return;
+       auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
+       auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
+       if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
+               return;
+ #ifdef CONFIG_MAC80211_IBSS_DEBUG
+       printk(KERN_DEBUG "%s: RX Auth SA=%pM DA=%pM BSSID=%pM."
+              "(auth_transaction=%d)\n",
+              sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction);
+ #endif
+       sta_info_destroy_addr(sdata, mgmt->sa);
+       ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false);
+       rcu_read_unlock();
+       /*
+        * IEEE 802.11 standard does not require authentication in IBSS
+        * networks and most implementations do not seem to use it.
+        * However, try to reply to authentication attempts if someone
+        * has actually implemented this.
+        */
+       ieee80211_send_auth(sdata, 2, WLAN_AUTH_OPEN, NULL, 0,
+                           mgmt->sa, sdata->u.ibss.bssid, NULL, 0, 0);
  }
  
  static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
                        } else {
                                rcu_read_unlock();
                                sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
-                                               mgmt->sa, supp_rates);
+                                               mgmt->sa, supp_rates, true);
                        }
                }
  
                ieee80211_sta_join_ibss(sdata, bss);
                supp_rates = ieee80211_sta_get_rates(local, elems, band);
                ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
-                                      supp_rates);
+                                      supp_rates, true);
                rcu_read_unlock();
        }
  
@@@ -643,8 -662,7 +663,7 @@@ static void ieee80211_sta_merge_ibss(st
               "IBSS networks with same SSID (merge)\n", sdata->name);
  
        ieee80211_request_internal_scan(sdata,
-                       ifibss->ssid, ifibss->ssid_len,
-                       ifibss->fixed_channel ? ifibss->channel : NULL);
+                       ifibss->ssid, ifibss->ssid_len, NULL);
  }
  
  static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
@@@ -855,9 -873,6 +874,6 @@@ static void ieee80211_rx_mgmt_probe_res
        size_t baselen;
        struct ieee802_11_elems elems;
  
-       if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN))
-               return; /* ignore ProbeResp to foreign address */
        baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
        if (baselen > len)
                return;
@@@ -945,7 -960,7 +961,7 @@@ void ieee80211_ibss_work(struct ieee802
                list_del(&sta->list);
                spin_unlock_bh(&ifibss->incomplete_lock);
  
-               ieee80211_ibss_finish_sta(sta);
+               ieee80211_ibss_finish_sta(sta, true);
                rcu_read_unlock();
                spin_lock_bh(&ifibss->incomplete_lock);
        }
diff --combined net/mac80211/iface.c
@@@ -318,9 -318,9 +318,9 @@@ static int ieee80211_do_open(struct net
                        goto err_del_interface;
                }
  
-               sta_info_move_state(sta, IEEE80211_STA_AUTH);
-               sta_info_move_state(sta, IEEE80211_STA_ASSOC);
-               sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
+               sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
+               sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
+               sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
  
                res = sta_info_insert(sta);
                if (res) {
@@@ -1181,6 -1181,13 +1181,13 @@@ int ieee80211_if_add(struct ieee80211_l
                sband = local->hw.wiphy->bands[i];
                sdata->rc_rateidx_mask[i] =
                        sband ? (1 << sband->n_bitrates) - 1 : 0;
+               if (sband)
+                       memcpy(sdata->rc_rateidx_mcs_mask[i],
+                              sband->ht_cap.mcs.rx_mask,
+                              sizeof(sdata->rc_rateidx_mcs_mask[i]));
+               else
+                       memset(sdata->rc_rateidx_mcs_mask[i], 0,
+                              sizeof(sdata->rc_rateidx_mcs_mask[i]));
        }
  
        /* setup type-dependent data */
@@@ -1314,7 -1321,6 +1321,7 @@@ u32 __ieee80211_recalc_idle(struct ieee
                        continue;
                }
                /* count everything else */
 +              sdata->vif.bss_conf.idle = false;
                count++;
        }
  
diff --combined net/mac80211/mesh_hwmp.c
@@@ -119,12 -119,12 +119,12 @@@ static int mesh_path_sel_frame_tx(enum 
        int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) +
                      sizeof(mgmt->u.action.u.mesh_action);
  
 -      skb = dev_alloc_skb(local->hw.extra_tx_headroom +
 +      skb = dev_alloc_skb(local->tx_headroom +
                            hdr_len +
                            2 + 37); /* max HWMP IE */
        if (!skb)
                return -1;
 -      skb_reserve(skb, local->hw.extra_tx_headroom);
 +      skb_reserve(skb, local->tx_headroom);
        mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);
        memset(mgmt, 0, hdr_len);
        mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
@@@ -250,12 -250,12 +250,12 @@@ int mesh_path_error_tx(u8 ttl, u8 *targ
        if (time_before(jiffies, ifmsh->next_perr))
                return -EAGAIN;
  
 -      skb = dev_alloc_skb(local->hw.extra_tx_headroom +
 +      skb = dev_alloc_skb(local->tx_headroom +
                            hdr_len +
                            2 + 15 /* PERR IE */);
        if (!skb)
                return -1;
 -      skb_reserve(skb, local->tx_headroom + local->hw.extra_tx_headroom);
 +      skb_reserve(skb, local->tx_headroom);
        mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);
        memset(mgmt, 0, hdr_len);
        mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
@@@ -575,7 -575,7 +575,7 @@@ static void hwmp_preq_frame_process(str
                        ifmsh->mshstats.dropped_frames_ttl++;
        }
  
-       if (forward) {
+       if (forward && ifmsh->mshcfg.dot11MeshForwarding) {
                u32 preq_id;
                u8 hopcount, flags;
  
@@@ -96,9 -96,9 +96,9 @@@ static struct sta_info *mesh_plink_allo
        if (!sta)
                return NULL;
  
-       sta_info_move_state(sta, IEEE80211_STA_AUTH);
-       sta_info_move_state(sta, IEEE80211_STA_ASSOC);
-       sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
+       sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
+       sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
+       sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
  
        set_sta_flag(sta, WLAN_STA_WME);
  
@@@ -172,7 -172,7 +172,7 @@@ static int mesh_plink_frame_tx(struct i
        int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) +
                      sizeof(mgmt->u.action.u.self_prot);
  
 -      skb = dev_alloc_skb(local->hw.extra_tx_headroom +
 +      skb = dev_alloc_skb(local->tx_headroom +
                            hdr_len +
                            2 + /* capability info */
                            2 + /* AID */
                            sdata->u.mesh.ie_len);
        if (!skb)
                return -1;
 -      skb_reserve(skb, local->hw.extra_tx_headroom);
 +      skb_reserve(skb, local->tx_headroom);
        mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);
        memset(mgmt, 0, hdr_len);
        mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
diff --combined net/mac80211/mlme.c
@@@ -127,7 -127,7 +127,7 @@@ static void run_again(struct ieee80211_
  
  void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata)
  {
-       if (sdata->local->hw.flags & IEEE80211_HW_BEACON_FILTER)
+       if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER)
                return;
  
        mod_timer(&sdata->u.mgd.bcn_mon_timer,
@@@ -547,7 -547,7 +547,7 @@@ static void ieee80211_handle_pwr_constr
        if (pwr_constr_elem_len != 1)
                return;
  
-       if ((*pwr_constr_elem <= conf->channel->max_power) &&
+       if ((*pwr_constr_elem <= conf->channel->max_reg_power) &&
            (*pwr_constr_elem != sdata->local->power_constr_level)) {
                sdata->local->power_constr_level = *pwr_constr_elem;
                ieee80211_hw_config(sdata->local, 0);
@@@ -1043,7 -1043,7 +1043,7 @@@ static void ieee80211_set_associated(st
        bss_info_changed |= BSS_CHANGED_BSSID;
  
        /* Tell the driver to monitor connection quality (if supported) */
-       if ((local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI) &&
+       if (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI &&
            bss_conf->cqm_rssi_thold)
                bss_info_changed |= BSS_CHANGED_CQM;
  
@@@ -1587,10 -1587,19 +1587,19 @@@ static bool ieee80211_assoc_success(str
                return false;
        }
  
-       sta_info_move_state(sta, IEEE80211_STA_AUTH);
-       sta_info_move_state(sta, IEEE80211_STA_ASSOC);
-       if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
-               sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
+       err = sta_info_move_state(sta, IEEE80211_STA_AUTH);
+       if (!err)
+               err = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
+       if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
+               err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
+       if (err) {
+               printk(KERN_DEBUG
+                      "%s: failed to move station %pM to desired state\n",
+                      sdata->name, sta->sta.addr);
+               WARN_ON(__sta_info_destroy(sta));
+               mutex_unlock(&sdata->local->sta_mtx);
+               return false;
+       }
  
        rates = 0;
        basic_rates = 0;
@@@ -1882,7 -1891,7 +1891,7 @@@ static void ieee80211_rx_mgmt_beacon(st
  
        if (bss_conf->cqm_rssi_thold &&
            ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT &&
-           !(local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI)) {
+           !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) {
                int sig = ifmgd->ave_beacon_signal / 16;
                int last_event = ifmgd->last_cqm_event_signal;
                int thold = bss_conf->cqm_rssi_thold;
@@@ -2750,6 -2759,7 +2759,6 @@@ int ieee80211_mgd_deauth(struct ieee802
  {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
 -      struct ieee80211_work *wk;
        u8 bssid[ETH_ALEN];
        bool assoc_bss = false;
  
                assoc_bss = true;
        } else {
                bool not_auth_yet = false;
 +              struct ieee80211_work *tmp, *wk = NULL;
  
                mutex_unlock(&ifmgd->mtx);
  
                mutex_lock(&local->mtx);
 -              list_for_each_entry(wk, &local->work_list, list) {
 -                      if (wk->sdata != sdata)
 +              list_for_each_entry(tmp, &local->work_list, list) {
 +                      if (tmp->sdata != sdata)
                                continue;
  
 -                      if (wk->type != IEEE80211_WORK_DIRECT_PROBE &&
 -                          wk->type != IEEE80211_WORK_AUTH &&
 -                          wk->type != IEEE80211_WORK_ASSOC &&
 -                          wk->type != IEEE80211_WORK_ASSOC_BEACON_WAIT)
 +                      if (tmp->type != IEEE80211_WORK_DIRECT_PROBE &&
 +                          tmp->type != IEEE80211_WORK_AUTH &&
 +                          tmp->type != IEEE80211_WORK_ASSOC &&
 +                          tmp->type != IEEE80211_WORK_ASSOC_BEACON_WAIT)
                                continue;
  
 -                      if (memcmp(req->bss->bssid, wk->filter_ta, ETH_ALEN))
 +                      if (memcmp(req->bss->bssid, tmp->filter_ta, ETH_ALEN))
                                continue;
  
 -                      not_auth_yet = wk->type == IEEE80211_WORK_DIRECT_PROBE;
 -                      list_del_rcu(&wk->list);
 -                      free_work(wk);
 +                      not_auth_yet = tmp->type == IEEE80211_WORK_DIRECT_PROBE;
 +                      list_del_rcu(&tmp->list);
 +                      synchronize_rcu();
 +                      wk = tmp;
                        break;
                }
                mutex_unlock(&local->mtx);
  
 +              if (wk && wk->type == IEEE80211_WORK_ASSOC) {
 +                      /* clean up dummy sta & TX sync */
 +                      sta_info_destroy_addr(wk->sdata, wk->filter_ta);
 +                      if (wk->assoc.synced)
 +                              drv_finish_tx_sync(local, wk->sdata,
 +                                                 wk->filter_ta,
 +                                                 IEEE80211_TX_SYNC_ASSOC);
 +              } else if (wk && wk->type == IEEE80211_WORK_AUTH) {
 +                      if (wk->probe_auth.synced)
 +                              drv_finish_tx_sync(local, wk->sdata,
 +                                                 wk->filter_ta,
 +                                                 IEEE80211_TX_SYNC_AUTH);
 +              }
 +              kfree(wk);
 +
                /*
                 * If somebody requests authentication and we haven't
                 * sent out an auth frame yet there's no need to send
diff --combined net/mac80211/rx.c
@@@ -611,7 -611,7 +611,7 @@@ static void ieee80211_sta_reorder_relea
        index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) %
                                                tid_agg_rx->buf_size;
        if (!tid_agg_rx->reorder_buf[index] &&
 -          tid_agg_rx->stored_mpdu_num > 1) {
 +          tid_agg_rx->stored_mpdu_num) {
                /*
                 * No buffers ready to be released, but check whether any
                 * frames in the reorder buffer have timed out.
@@@ -1145,19 -1145,15 +1145,15 @@@ static void ap_sta_ps_start(struct sta_
  
  static void ap_sta_ps_end(struct sta_info *sta)
  {
-       struct ieee80211_sub_if_data *sdata = sta->sdata;
-       atomic_dec(&sdata->bss->num_sta_ps);
  #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
        printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n",
-              sdata->name, sta->sta.addr, sta->sta.aid);
+              sta->sdata->name, sta->sta.addr, sta->sta.aid);
  #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
  
        if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
  #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
                printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n",
-                      sdata->name, sta->sta.addr, sta->sta.aid);
+                      sta->sdata->name, sta->sta.addr, sta->sta.aid);
  #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
                return;
        }
@@@ -2180,9 -2176,6 +2176,6 @@@ ieee80211_rx_h_mgmt_check(struct ieee80
        if (rx->sdata->vif.type == NL80211_IFTYPE_AP &&
            ieee80211_is_beacon(mgmt->frame_control) &&
            !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) {
-               struct ieee80211_rx_status *status;
-               status = IEEE80211_SKB_RXCB(rx->skb);
                cfg80211_report_obss_beacon(rx->local->hw.wiphy,
                                            rx->skb->data, rx->skb->len,
                                            status->freq, GFP_ATOMIC);