#include <linux/delay.h>
 #include "types.h"             /* forward structure declarations */
 
+/* map/unmap direction */
+#define        DMA_TX  1               /* TX direction for DMA */
+#define        DMA_RX  2               /* RX direction for DMA */
+
 /* DMA structure:
  *  support two DMA engines: 32 bits address or 64 bit addressing
  *  basic DMA register set is per channel(transmit or receive)
        u32 status1;    /* active descriptor, xmt error */
 };
 
-/* map/unmap direction */
-#define        DMA_TX  1               /* TX direction for DMA */
-#define        DMA_RX  2               /* RX direction for DMA */
-#define BUS_SWAP32(v)          (v)
-
 /* range param for dma_getnexttxp() and dma_txreclaim */
 enum txd_range {
        DMA_RANGE_ALL = 1,
 
 #define LOCK(wl)       spin_lock_bh(&(wl)->lock)
 #define UNLOCK(wl)     spin_unlock_bh(&(wl)->lock)
 
-#define HW_TO_WL(hw)    (hw->priv)
-#define WL_TO_HW(wl)     (wl->pub->ieee_hw)
-
 /* locking from inside brcms_isr */
 #define ISR_LOCK(wl, flags)\
        do {\
 {
        struct brcms_info *wl = hw->priv;
        bool blocked;
-       /*
-         struct ieee80211_channel *curchan = hw->conf.channel;
-       */
 
        ieee80211_wake_queues(hw);
        LOCK(wl);
                return -EOPNOTSUPP;
        }
 
-       wl = HW_TO_WL(hw);
+       wl = hw->priv;
        LOCK(wl);
        err = brcms_up(wl);
        UNLOCK(wl);
 {
        struct brcms_info *wl;
 
-       wl = HW_TO_WL(hw);
+       wl = hw->priv;
 
        /* put driver in down state */
        LOCK(wl);
 ieee_set_channel(struct ieee80211_hw *hw, struct ieee80211_channel *chan,
                 enum nl80211_channel_type type)
 {
-       struct brcms_info *wl = HW_TO_WL(hw);
+       struct brcms_info *wl = hw->priv;
        int err = 0;
 
        switch (type) {
 static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct ieee80211_conf *conf = &hw->conf;
-       struct brcms_info *wl = HW_TO_WL(hw);
+       struct brcms_info *wl = hw->priv;
        int err = 0;
        int new_int;
        struct wiphy *wiphy = hw->wiphy;
                        struct ieee80211_vif *vif,
                        struct ieee80211_bss_conf *info, u32 changed)
 {
-       struct brcms_info *wl = HW_TO_WL(hw);
+       struct brcms_info *wl = hw->priv;
        struct wiphy *wiphy = hw->wiphy;
        int val;
 
 
 static void brcms_ops_rfkill_poll(struct ieee80211_hw *hw)
 {
-       struct brcms_info *wl = HW_TO_WL(hw);
+       struct brcms_info *wl = hw->priv;
        bool blocked;
 
        LOCK(wl);
 
 static void brcms_ops_flush(struct ieee80211_hw *hw, bool drop)
 {
-       struct brcms_info *wl = HW_TO_WL(hw);
+       struct brcms_info *wl = hw->priv;
 
        no_printk("%s: drop = %s\n", __func__, drop ? "true" : "false");
 
        int status;
 
        hw = pci_get_drvdata(pdev);
-       wl = HW_TO_WL(hw);
+       wl = hw->priv;
        if (!wl) {
                pr_err("wl: brcms_remove: pci_get_drvdata failed\n");
                return;
  */
 static int ieee_hw_rate_init(struct ieee80211_hw *hw)
 {
-       struct brcms_info *wl = HW_TO_WL(hw);
+       struct brcms_info *wl = hw->priv;
        int has_5g;
        char phy_list[4];
 
        struct ieee80211_hw *hw;
 
        hw = pci_get_drvdata(pdev);
-       wl = HW_TO_WL(hw);
+       wl = hw->priv;
        if (!wl) {
                wiphy_err(wl->wiphy,
                          "brcms_suspend: pci_get_drvdata failed\n");
        u32 val;
 
        hw = pci_get_drvdata(pdev);
-       wl = HW_TO_WL(hw);
+       wl = hw->priv;
        if (!wl) {
                wiphy_err(wl->wiphy,
                          "wl: brcms_resume: pci_get_drvdata failed\n");
  */
 void brcms_init(struct brcms_info *wl)
 {
-       BCMMSG(WL_TO_HW(wl)->wiphy, "wl%d\n", wl->pub->unit);
+       BCMMSG(wl->pub->ieee_hw->wiphy, "wl%d\n", wl->pub->unit);
        brcms_reset(wl);
 
        brcms_c_init(wl->wlc);
  */
 uint brcms_reset(struct brcms_info *wl)
 {
-       BCMMSG(WL_TO_HW(wl)->wiphy, "wl%d\n", wl->pub->unit);
+       BCMMSG(wl->pub->ieee_hw->wiphy, "wl%d\n", wl->pub->unit);
        brcms_c_reset(wl->wlc);
 
        /* dpc will not be rescheduled */