]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/staging/wlan-ng/hfa384x_usb.c
Staging: wlan-ng: Remove dead/unused code from p80211req.c
[linux-2.6-omap-h63xx.git] / drivers / staging / wlan-ng / hfa384x_usb.c
index db0c502f5d9066762339caf13f575510e69dfffa..6dfbac33aed596cdc5dbb08db51d190d2cfe1f67 100644 (file)
 /* System Includes */
 #define WLAN_DBVAR     prism2_debug
 
-#include "version.h"
-
-
 #include <linux/version.h>
 
 #include <linux/module.h>
 #include <asm/bitops.h>
 #include <linux/list.h>
 #include <linux/usb.h>
+#include <linux/byteorder/generic.h>
 
 #include "wlan_compat.h"
 
-#if (WLAN_HOSTIF != WLAN_USB)
-#error "This file is specific to USB"
-#endif
-
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-static int
-wait_for_completion_interruptible(struct completion *x)
-{
-  int ret = 0;
-
-  might_sleep();
-
-  spin_lock_irq(&x->wait.lock);
-  if (!x->done) {
-    DECLARE_WAITQUEUE(wait, current);
-
-    wait.flags |= WQ_FLAG_EXCLUSIVE;
-    __add_wait_queue_tail(&x->wait, &wait);
-    do {
-      if (signal_pending(current)) {
-        ret = -ERESTARTSYS;
-        __remove_wait_queue(&x->wait, &wait);
-        goto out;
-      }
-      __set_current_state(TASK_INTERRUPTIBLE);
-      spin_unlock_irq(&x->wait.lock);
-      schedule();
-      spin_lock_irq(&x->wait.lock);
-    } while (!x->done);
-    __remove_wait_queue(&x->wait, &wait);
-  }
-  x->done--;
-out:
-  spin_unlock_irq(&x->wait.lock);
-
-  return ret;
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69)
-static void
-usb_init_urb(struct urb *urb)
-{
-       memset(urb, 0, sizeof(*urb));
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */
-       urb->count = (atomic_t)ATOMIC_INIT(1);
-#endif
-       spin_lock_init(&urb->lock);
-}
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */
-#  define SUBMIT_URB(u,f)  usb_submit_urb(u,f)
-#else
-#  define SUBMIT_URB(u,f)  usb_submit_urb(u)
-#endif
+#define SUBMIT_URB(u,f)  usb_submit_urb(u,f)
 
 /*================================================================*/
 /* Project Includes */
@@ -220,6 +162,8 @@ enum cmd_mode
 typedef enum cmd_mode CMD_MODE;
 
 #define THROTTLE_JIFFIES       (HZ/8)
+#define URB_ASYNC_UNLINK 0
+#define USB_QUEUE_BULK 0
 
 /*================================================================*/
 /* Local Macros */
@@ -257,21 +201,12 @@ submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t flags);
 
 /*---------------------------------------------------*/
 /* Callbacks */
-#ifdef URB_ONLY_CALLBACK
 static void
 hfa384x_usbout_callback(struct urb *urb);
 static void
 hfa384x_ctlxout_callback(struct urb *urb);
 static void
 hfa384x_usbin_callback(struct urb *urb);
-#else
-static void
-hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs);
-static void
-hfa384x_ctlxout_callback(struct urb *urb, struct pt_regs *regs);
-static void
-hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs);
-#endif
 
 static void
 hfa384x_usbin_txcompl(wlandevice_t *wlandev, hfa384x_usbin_t *usbin);
@@ -358,9 +293,9 @@ static int
 hfa384x_dorrid(
        hfa384x_t *hw,
        CMD_MODE mode,
-       UINT16  rid,
+       u16     rid,
        void    *riddata,
-       UINT    riddatalen,
+       unsigned int    riddatalen,
        ctlx_cmdcb_t cmdcb,
        ctlx_usercb_t usercb,
        void    *usercb_data);
@@ -369,9 +304,9 @@ static int
 hfa384x_dowrid(
        hfa384x_t *hw,
        CMD_MODE mode,
-       UINT16  rid,
+       u16     rid,
        void    *riddata,
-       UINT    riddatalen,
+       unsigned int    riddatalen,
        ctlx_cmdcb_t cmdcb,
        ctlx_usercb_t usercb,
        void    *usercb_data);
@@ -380,10 +315,10 @@ static int
 hfa384x_dormem(
        hfa384x_t *hw,
        CMD_MODE mode,
-       UINT16  page,
-       UINT16  offset,
+       u16     page,
+       u16     offset,
        void    *data,
-       UINT    len,
+       unsigned int    len,
        ctlx_cmdcb_t cmdcb,
        ctlx_usercb_t usercb,
        void    *usercb_data);
@@ -392,16 +327,16 @@ static int
 hfa384x_dowmem(
        hfa384x_t *hw,
        CMD_MODE mode,
-       UINT16  page,
-       UINT16  offset,
+       u16     page,
+       u16     offset,
        void    *data,
-       UINT    len,
+       unsigned int    len,
        ctlx_cmdcb_t cmdcb,
        ctlx_usercb_t usercb,
        void    *usercb_data);
 
 static int
-hfa384x_isgood_pdrcode(UINT16 pdrcode);
+hfa384x_isgood_pdrcode(u16 pdrcode);
 
 /*================================================================*/
 /* Function Definitions */
@@ -435,17 +370,17 @@ dbprint_urb(struct urb* urb)
        WLAN_LOG_DEBUG(3,"urb->pipe=0x%08x\n", urb->pipe);
        WLAN_LOG_DEBUG(3,"urb->status=0x%08x\n", urb->status);
        WLAN_LOG_DEBUG(3,"urb->transfer_flags=0x%08x\n", urb->transfer_flags);
-       WLAN_LOG_DEBUG(3,"urb->transfer_buffer=0x%08x\n", (UINT)urb->transfer_buffer);
+       WLAN_LOG_DEBUG(3,"urb->transfer_buffer=0x%08x\n", (unsigned int)urb->transfer_buffer);
        WLAN_LOG_DEBUG(3,"urb->transfer_buffer_length=0x%08x\n", urb->transfer_buffer_length);
        WLAN_LOG_DEBUG(3,"urb->actual_length=0x%08x\n", urb->actual_length);
        WLAN_LOG_DEBUG(3,"urb->bandwidth=0x%08x\n", urb->bandwidth);
-       WLAN_LOG_DEBUG(3,"urb->setup_packet(ctl)=0x%08x\n", (UINT)urb->setup_packet);
+       WLAN_LOG_DEBUG(3,"urb->setup_packet(ctl)=0x%08x\n", (unsigned int)urb->setup_packet);
        WLAN_LOG_DEBUG(3,"urb->start_frame(iso/irq)=0x%08x\n", urb->start_frame);
        WLAN_LOG_DEBUG(3,"urb->interval(irq)=0x%08x\n", urb->interval);
        WLAN_LOG_DEBUG(3,"urb->error_count(iso)=0x%08x\n", urb->error_count);
        WLAN_LOG_DEBUG(3,"urb->timeout=0x%08x\n", urb->timeout);
-       WLAN_LOG_DEBUG(3,"urb->context=0x%08x\n", (UINT)urb->context);
-       WLAN_LOG_DEBUG(3,"urb->complete=0x%08x\n", (UINT)urb->complete);
+       WLAN_LOG_DEBUG(3,"urb->context=0x%08x\n", (unsigned int)urb->context);
+       WLAN_LOG_DEBUG(3,"urb->complete=0x%08x\n", (unsigned int)urb->complete);
 }
 #endif
 
@@ -472,8 +407,6 @@ submit_rx_urb(hfa384x_t *hw, gfp_t memflags)
        struct sk_buff *skb;
        int result;
 
-       DBFENTER;
-
        skb = dev_alloc_skb(sizeof(hfa384x_usbin_t));
        if (skb == NULL) {
                result = -ENOMEM;
@@ -494,7 +427,7 @@ submit_rx_urb(hfa384x_t *hw, gfp_t memflags)
 
                /* Check whether we need to reset the RX pipe */
                if (result == -EPIPE) {
-                       WLAN_LOG_WARNING("%s rx pipe stalled: requesting reset\n",
+                       printk(KERN_WARNING "%s rx pipe stalled: requesting reset\n",
                                         hw->wlandev->netdev->name);
                        if ( !test_and_set_bit(WORK_RX_HALT, &hw->usb_flags) )
                                schedule_work(&hw->usb_work);
@@ -508,8 +441,6 @@ submit_rx_urb(hfa384x_t *hw, gfp_t memflags)
        }
 
  done:
-
-       DBFEXIT;
        return result;
 }
 
@@ -537,8 +468,6 @@ submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t memflags)
        struct net_device *netdev = hw->wlandev->netdev;
        int result;
 
-       DBFENTER;
-
        result = -ENOLINK;
        if ( netif_running(netdev) ) {
 
@@ -547,7 +476,7 @@ submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t memflags)
 
                        /* Test whether we need to reset the TX pipe */
                        if (result == -EPIPE) {
-                               WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n",
+                               printk(KERN_WARNING "%s tx pipe stalled: requesting reset\n",
                                                 netdev->name);
                                set_bit(WORK_TX_HALT, &hw->usb_flags);
                                schedule_work(&hw->usb_work);
@@ -557,8 +486,6 @@ submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t memflags)
                }
        }
 
-       DBFEXIT;
-
        return result;
 }
 
@@ -584,13 +511,10 @@ hfa384x_usb_defer(struct work_struct *data)
        hfa384x_t *hw = container_of(data, struct hfa384x, usb_work);
        struct net_device *netdev = hw->wlandev->netdev;
 
-       DBFENTER;
-
        /* Don't bother trying to reset anything if the plug
         * has been pulled ...
         */
        if ( hw->wlandev->hwremoved ) {
-               DBFEXIT;
                return;
        }
 
@@ -652,10 +576,8 @@ hfa384x_usb_defer(struct work_struct *data)
 
        /* Resume transmitting. */
        if ( test_and_clear_bit(WORK_TX_RESUME, &hw->usb_flags) ) {
-               p80211netdev_wake_queue(hw->wlandev);
+               netif_wake_queue(hw->wlandev->netdev);
        }
-
-       DBFEXIT;
 }
 
 
@@ -683,8 +605,6 @@ hfa384x_usb_defer(struct work_struct *data)
 void
 hfa384x_create( hfa384x_t *hw, struct usb_device *usb)
 {
-       DBFENTER;
-
        memset(hw, 0, sizeof(hfa384x_t));
        hw->usb = usb;
 
@@ -711,8 +631,8 @@ hfa384x_create( hfa384x_t *hw, struct usb_device *usb)
        tasklet_init(&hw->completion_bh,
                     hfa384x_usbctlx_completion_task,
                     (unsigned long)hw);
-       INIT_WORK2(&hw->link_bh, prism2sta_processing_defer);
-       INIT_WORK2(&hw->usb_work, hfa384x_usb_defer);
+       INIT_WORK(&hw->link_bh, prism2sta_processing_defer);
+       INIT_WORK(&hw->usb_work, hfa384x_usb_defer);
 
        init_timer(&hw->throttle);
        hw->throttle.function = hfa384x_usb_throttlefn;
@@ -733,12 +653,10 @@ hfa384x_create( hfa384x_t *hw, struct usb_device *usb)
        hw->link_status = HFA384x_LINK_NOTCONNECTED;
        hw->state = HFA384x_STATE_INIT;
 
-        INIT_WORK2(&hw->commsqual_bh, prism2sta_commsqual_defer);
+        INIT_WORK(&hw->commsqual_bh, prism2sta_commsqual_defer);
        init_timer(&hw->commsqual_timer);
        hw->commsqual_timer.data = (unsigned long) hw;
        hw->commsqual_timer.function = prism2sta_commsqual_timer;
-
-       DBFEXIT;
 }
 
 
@@ -769,8 +687,6 @@ hfa384x_destroy( hfa384x_t *hw)
 {
        struct sk_buff *skb;
 
-       DBFENTER;
-
        if ( hw->state == HFA384x_STATE_RUNNING ) {
                hfa384x_drvr_stop(hw);
        }
@@ -785,8 +701,6 @@ hfa384x_destroy( hfa384x_t *hw)
         while ( (skb = skb_dequeue(&hw->authq)) ) {
                 dev_kfree_skb(skb);
         }
-
-       DBFEXIT;
 }
 
 
@@ -814,8 +728,6 @@ static int
 usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp,
                    hfa384x_cmdresult_t *result)
 {
-       DBFENTER;
-
        result->status = hfa384x2host_16(cmdresp->status);
        result->resp0 = hfa384x2host_16(cmdresp->resp0);
        result->resp1 = hfa384x2host_16(cmdresp->resp1);
@@ -828,7 +740,6 @@ usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp,
                        result->resp1,
                        result->resp2);
 
-       DBFEXIT;
        return (result->status & HFA384x_STATUS_RESULT);
 }
 
@@ -836,13 +747,10 @@ static void
 usbctlx_get_rridresult(const hfa384x_usb_rridresp_t *rridresp,
                        hfa384x_rridresult_t *result)
 {
-       DBFENTER;
-
        result->rid = hfa384x2host_16(rridresp->rid);
        result->riddata = rridresp->data;
        result->riddata_len = ((hfa384x2host_16(rridresp->frmlen) - 1) * 2);
 
-       DBFEXIT;
 }
 
 
@@ -888,7 +796,7 @@ struct usbctlx_rrid_completor
 
        const hfa384x_usb_rridresp_t    *rridresp;
        void                    *riddata;
-       UINT                    riddatalen;
+       unsigned int                    riddatalen;
 };
 typedef struct usbctlx_rrid_completor usbctlx_rrid_completor_t;
 
@@ -901,7 +809,7 @@ static int usbctlx_rrid_completor_fn(usbctlx_completor_t *head)
 
        /* Validate the length, note body len calculation in bytes */
        if ( rridresult.riddata_len != complete->riddatalen ) {
-               WLAN_LOG_WARNING(
+               printk(KERN_WARNING
                        "RID len mismatch, rid=0x%04x hlen=%d fwlen=%d\n",
                        rridresult.rid,
                        complete->riddatalen,
@@ -919,7 +827,7 @@ static inline usbctlx_completor_t*
 init_rrid_completor(usbctlx_rrid_completor_t *completor,
                     const hfa384x_usb_rridresp_t *rridresp,
                     void *riddata,
-                    UINT riddatalen)
+                    unsigned int riddatalen)
 {
        completor->head.complete = usbctlx_rrid_completor_fn;
        completor->rridresp = rridresp;
@@ -952,7 +860,7 @@ struct usbctlx_rmem_completor
 
         const hfa384x_usb_rmemresp_t  *rmemresp;
         void                          *data;
-        UINT                          len;
+        unsigned int                          len;
 };
 typedef struct usbctlx_rmem_completor usbctlx_rmem_completor_t;
 
@@ -969,7 +877,7 @@ static inline usbctlx_completor_t*
 init_rmem_completor(usbctlx_rmem_completor_t *completor,
                     hfa384x_usb_rmemresp_t *rmemresp,
                     void *data,
-                    UINT len)
+                    unsigned int len)
 {
        completor->head.complete = usbctlx_rmem_completor_fn;
        completor->rmemresp = rmemresp;
@@ -1002,8 +910,6 @@ init_rmem_completor(usbctlx_rmem_completor_t *completor,
 static void
 hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
 {
-       DBFENTER;
-
        if ( ctlx->usercb != NULL ) {
                hfa384x_cmdresult_t cmdresult;
 
@@ -1016,8 +922,6 @@ hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
 
                ctlx->usercb(hw, &cmdresult, ctlx->usercb_data);
        }
-
-       DBFEXIT;
 }
 
 
@@ -1044,8 +948,6 @@ hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
 static void
 hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
 {
-       DBFENTER;
-
        if ( ctlx->usercb != NULL ) {
                hfa384x_rridresult_t rridresult;
 
@@ -1058,8 +960,6 @@ hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
 
                ctlx->usercb(hw, &rridresult, ctlx->usercb_data);
        }
-
-       DBFEXIT;
 }
 
 static inline int
@@ -1080,7 +980,7 @@ hfa384x_docmd_async(hfa384x_t *hw,
 }
 
 static inline int
-hfa384x_dorrid_wait(hfa384x_t *hw, UINT16 rid, void *riddata, UINT riddatalen)
+hfa384x_dorrid_wait(hfa384x_t *hw, u16 rid, void *riddata, unsigned int riddatalen)
 {
        return hfa384x_dorrid(hw, DOWAIT,
                              rid, riddata, riddatalen,
@@ -1089,7 +989,7 @@ hfa384x_dorrid_wait(hfa384x_t *hw, UINT16 rid, void *riddata, UINT riddatalen)
 
 static inline int
 hfa384x_dorrid_async(hfa384x_t *hw,
-                     UINT16 rid, void *riddata, UINT riddatalen,
+                     u16 rid, void *riddata, unsigned int riddatalen,
                      ctlx_cmdcb_t cmdcb,
                      ctlx_usercb_t usercb,
                      void *usercb_data)
@@ -1100,7 +1000,7 @@ hfa384x_dorrid_async(hfa384x_t *hw,
 }
 
 static inline int
-hfa384x_dowrid_wait(hfa384x_t *hw, UINT16 rid, void *riddata, UINT riddatalen)
+hfa384x_dowrid_wait(hfa384x_t *hw, u16 rid, void *riddata, unsigned int riddatalen)
 {
        return hfa384x_dowrid(hw, DOWAIT,
                              rid, riddata, riddatalen,
@@ -1109,7 +1009,7 @@ hfa384x_dowrid_wait(hfa384x_t *hw, UINT16 rid, void *riddata, UINT riddatalen)
 
 static inline int
 hfa384x_dowrid_async(hfa384x_t *hw,
-                     UINT16 rid, void *riddata, UINT riddatalen,
+                     u16 rid, void *riddata, unsigned int riddatalen,
                      ctlx_cmdcb_t cmdcb,
                      ctlx_usercb_t usercb,
                      void *usercb_data)
@@ -1121,7 +1021,7 @@ hfa384x_dowrid_async(hfa384x_t *hw,
 
 static inline int
 hfa384x_dormem_wait(hfa384x_t *hw,
-                    UINT16 page, UINT16 offset, void *data, UINT len)
+                    u16 page, u16 offset, void *data, unsigned int len)
 {
        return hfa384x_dormem(hw, DOWAIT,
                              page, offset, data, len,
@@ -1130,7 +1030,7 @@ hfa384x_dormem_wait(hfa384x_t *hw,
 
 static inline int
 hfa384x_dormem_async(hfa384x_t *hw,
-                     UINT16 page, UINT16 offset, void *data, UINT len,
+                     u16 page, u16 offset, void *data, unsigned int len,
                      ctlx_cmdcb_t cmdcb,
                      ctlx_usercb_t usercb,
                      void *usercb_data)
@@ -1143,10 +1043,10 @@ hfa384x_dormem_async(hfa384x_t *hw,
 static inline int
 hfa384x_dowmem_wait(
         hfa384x_t *hw,
-        UINT16  page,
-        UINT16  offset,
+        u16  page,
+        u16  offset,
         void    *data,
-        UINT    len)
+        unsigned int    len)
 {
        return hfa384x_dowmem(hw, DOWAIT,
                                   page, offset, data, len,
@@ -1156,10 +1056,10 @@ hfa384x_dowmem_wait(
 static inline int
 hfa384x_dowmem_async(
         hfa384x_t *hw,
-        UINT16  page,
-        UINT16  offset,
+        u16  page,
+        u16  offset,
         void    *data,
-        UINT    len,
+        unsigned int    len,
         ctlx_cmdcb_t cmdcb,
         ctlx_usercb_t usercb,
         void    *usercb_data)
@@ -1195,9 +1095,6 @@ hfa384x_cmd_initialize(hfa384x_t *hw)
        int     i;
        hfa384x_metacmd_t cmd;
 
-       DBFENTER;
-
-
        cmd.cmd = HFA384x_CMDCODE_INIT;
        cmd.parm0 = 0;
        cmd.parm1 = 0;
@@ -1221,7 +1118,6 @@ hfa384x_cmd_initialize(hfa384x_t *hw)
 
         hw->link_status = HFA384x_LINK_NOTCONNECTED;
 
-       DBFEXIT;
        return result;
 }
 
@@ -1246,13 +1142,11 @@ hfa384x_cmd_initialize(hfa384x_t *hw)
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_cmd_disable(hfa384x_t *hw, UINT16 macport)
+int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
 {
        int     result = 0;
        hfa384x_metacmd_t cmd;
 
-       DBFENTER;
-
        cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DISABLE) |
                  HFA384x_CMD_MACPORT_SET(macport);
        cmd.parm0 = 0;
@@ -1261,7 +1155,6 @@ int hfa384x_cmd_disable(hfa384x_t *hw, UINT16 macport)
 
        result = hfa384x_docmd_wait(hw, &cmd);
 
-       DBFEXIT;
        return result;
 }
 
@@ -1286,13 +1179,11 @@ int hfa384x_cmd_disable(hfa384x_t *hw, UINT16 macport)
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_cmd_enable(hfa384x_t *hw, UINT16 macport)
+int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
 {
        int     result = 0;
        hfa384x_metacmd_t cmd;
 
-       DBFENTER;
-
        cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ENABLE) |
                  HFA384x_CMD_MACPORT_SET(macport);
        cmd.parm0 = 0;
@@ -1301,98 +1192,8 @@ int hfa384x_cmd_enable(hfa384x_t *hw, UINT16 macport)
 
        result = hfa384x_docmd_wait(hw, &cmd);
 
-       DBFEXIT;
-       return result;
-}
-
-
-/*----------------------------------------------------------------
-* hfa384x_cmd_notify
-*
-* Sends an info frame to the firmware to alter the behavior
-* of the f/w asynch processes.  Can only be called when the MAC
-* is in the enabled state.
-*
-* Arguments:
-*      hw              device structure
-*      reclaim         [0|1] indicates whether the given FID will
-*                      be handed back (via Alloc event) for reuse.
-*                      (host order)
-*      fid             FID of buffer containing the frame that was
-*                      previously copied to MAC memory via the bap.
-*                      (host order)
-*
-* Returns:
-*      0               success
-*      >0              f/w reported failure - f/w status code
-*      <0              driver reported error (timeout|bad arg)
-*
-* Side effects:
-*      hw->resp0 will contain the FID being used by async notify
-*      process.  If reclaim==0, resp0 will be the same as the fid
-*      argument.  If reclaim==1, resp0 will be the different.
-*
-* Call context:
-*      process
-----------------------------------------------------------------*/
-int hfa384x_cmd_notify(hfa384x_t *hw, UINT16 reclaim, UINT16 fid,
-                      void *buf, UINT16 len)
-{
-#if 0
-       int     result = 0;
-       UINT16  cmd;
-       DBFENTER;
-       cmd =   HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_NOTIFY) |
-               HFA384x_CMD_RECL_SET(reclaim);
-       result = hfa384x_docmd_wait(hw, cmd);
-
-       DBFEXIT;
-       return result;
-#endif
-return 0;
-}
-
-
-#if 0
-/*----------------------------------------------------------------
-* hfa384x_cmd_inquiry
-*
-* Requests an info frame from the firmware.  The info frame will
-* be delivered asynchronously via the Info event.
-*
-* Arguments:
-*      hw              device structure
-*      fid             FID of the info frame requested. (host order)
-*
-* Returns:
-*      0               success
-*      >0              f/w reported failure - f/w status code
-*      <0              driver reported error (timeout|bad arg)
-*
-* Side effects:
-*
-* Call context:
-*      process
-----------------------------------------------------------------*/
-int hfa384x_cmd_inquiry(hfa384x_t *hw, UINT16 fid)
-{
-       int     result = 0;
-       hfa384x_metacmd_t cmd;
-
-       DBFENTER;
-
-       cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_INQ);
-       cmd.parm0 = 0;
-       cmd.parm1 = 0;
-       cmd.parm2 = 0;
-
-       result = hfa384x_docmd_wait(hw, &cmd);
-
-       DBFEXIT;
        return result;
 }
-#endif
-
 
 /*----------------------------------------------------------------
 * hfa384x_cmd_monitor
@@ -1423,13 +1224,11 @@ int hfa384x_cmd_inquiry(hfa384x_t *hw, UINT16 fid)
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_cmd_monitor(hfa384x_t *hw, UINT16 enable)
+int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
 {
        int     result = 0;
        hfa384x_metacmd_t cmd;
 
-       DBFENTER;
-
        cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
                HFA384x_CMD_AINFO_SET(enable);
        cmd.parm0 = 0;
@@ -1438,7 +1237,6 @@ int hfa384x_cmd_monitor(hfa384x_t *hw, UINT16 enable)
 
        result = hfa384x_docmd_wait(hw, &cmd);
 
-       DBFEXIT;
        return result;
 }
 
@@ -1481,13 +1279,12 @@ int hfa384x_cmd_monitor(hfa384x_t *hw, UINT16 enable)
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_cmd_download(hfa384x_t *hw, UINT16 mode, UINT16 lowaddr,
-                               UINT16 highaddr, UINT16 codelen)
+int hfa384x_cmd_download(hfa384x_t *hw, u16 mode, u16 lowaddr,
+                               u16 highaddr, u16 codelen)
 {
        int     result = 0;
        hfa384x_metacmd_t cmd;
 
-       DBFENTER;
        WLAN_LOG_DEBUG(5,
                "mode=%d, lowaddr=0x%04x, highaddr=0x%04x, codelen=%d\n",
                mode, lowaddr, highaddr, codelen);
@@ -1501,7 +1298,6 @@ int hfa384x_cmd_download(hfa384x_t *hw, UINT16 mode, UINT16 lowaddr,
 
        result = hfa384x_docmd_wait(hw, &cmd);
 
-       DBFEXIT;
        return result;
 }
 
@@ -1532,11 +1328,9 @@ int hfa384x_cmd_download(hfa384x_t *hw, UINT16 mode, UINT16 lowaddr,
 ----------------------------------------------------------------*/
 void
 hfa384x_copy_from_aux(
-       hfa384x_t *hw, UINT32 cardaddr, UINT32 auxctl, void *buf, UINT len)
+       hfa384x_t *hw, u32 cardaddr, u32 auxctl, void *buf, unsigned int len)
 {
-       DBFENTER;
-       WLAN_LOG_ERROR("not used in USB.\n");
-       DBFEXIT;
+       printk(KERN_ERR "not used in USB.\n");
 }
 
 
@@ -1566,11 +1360,9 @@ hfa384x_copy_from_aux(
 ----------------------------------------------------------------*/
 void
 hfa384x_copy_to_aux(
-       hfa384x_t *hw, UINT32 cardaddr, UINT32 auxctl, void *buf, UINT len)
+       hfa384x_t *hw, u32 cardaddr, u32 auxctl, void *buf, unsigned int len)
 {
-       DBFENTER;
-       WLAN_LOG_ERROR("not used in USB.\n");
-       DBFEXIT;
+       printk(KERN_ERR "not used in USB.\n");
 }
 
 
@@ -1599,84 +1391,13 @@ hfa384x_copy_to_aux(
 ----------------------------------------------------------------*/
 int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis)
 {
-#if 0
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-       struct usb_device       *parent = hw->usb->parent;
-       int                     i;
-       int                     port = -1;
-#endif
-#endif
        int                     result = 0;
 
-
-#define P2_USB_RT_PORT         (USB_TYPE_CLASS | USB_RECIP_OTHER)
-#define P2_USB_FEAT_RESET      4
-#define P2_USB_FEAT_C_RESET    20
-
-       DBFENTER;
-
-#if 0
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-       /* Find the hub port */
-       for ( i = 0; i < parent->maxchild; i++) {
-               if (parent->children[i] == hw->usb) {
-                       port = i;
-                       break;
-               }
-       }
-       if (port < 0) return -ENOENT;
-
-       /* Set and clear the reset */
-       usb_control_msg(parent, usb_sndctrlpipe(parent, 0),
-               USB_REQ_SET_FEATURE, P2_USB_RT_PORT, P2_USB_FEAT_RESET,
-               port+1, NULL, 0, 1*HZ);
-       wait_ms(holdtime);
-       usb_control_msg(parent, usb_sndctrlpipe(parent, 0),
-               USB_REQ_CLEAR_FEATURE, P2_USB_RT_PORT, P2_USB_FEAT_C_RESET,
-               port+1, NULL, 0, 1*HZ);
-       wait_ms(settletime);
-
-       /* Set the device address */
-       result=usb_set_address(hw->usb);
-       if (result < 0) {
-               WLAN_LOG_ERROR("reset_usbdev: Dev not accepting address, "
-                       "result=%d\n", result);
-               clear_bit(hw->usb->devnum, &hw->usb->bus->devmap.devicemap);
-               hw->usb->devnum = -1;
-               goto done;
-       }
-       /* Let the address settle */
-       wait_ms(20);
-
-       /* Assume we're reusing the original descriptor data */
-
-       /* Set the configuration. */
-       WLAN_LOG_DEBUG(3, "Setting Configuration %d\n",
-               hw->usb->config[0].bConfigurationValue);
-       result=usb_set_configuration(hw->usb, hw->usb->config[0].bConfigurationValue);
-       if ( result ) {
-               WLAN_LOG_ERROR("usb_set_configuration() failed, result=%d.\n",
-                               result);
-               goto done;
-       }
-       /* Let the configuration settle */
-       wait_ms(20);
-
- done:
-#else
        result=usb_reset_device(hw->usb);
        if(result<0) {
-               WLAN_LOG_ERROR("usb_reset_device() failed, result=%d.\n",result);
+               printk(KERN_ERR "usb_reset_device() failed, result=%d.\n",result);
        }
-#endif
-#endif
 
-       result=usb_reset_device(hw->usb);
-       if(result<0) {
-               WLAN_LOG_ERROR("usb_reset_device() failed, result=%d.\n",result);
-       }
-
-       DBFEXIT;
        return result;
 }
 
@@ -1712,8 +1433,6 @@ static int hfa384x_usbctlx_complete_sync(hfa384x_t *hw,
        unsigned long flags;
        int result;
 
-       DBFENTER;
-
        result = wait_for_completion_interruptible(&ctlx->done);
 
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
@@ -1780,7 +1499,7 @@ static int hfa384x_usbctlx_complete_sync(hfa384x_t *hw,
                if (ctlx->state == CTLX_COMPLETE) {
                        result = completor->complete(completor);
                } else {
-                       WLAN_LOG_WARNING("CTLX[%d] error: state(%s)\n",
+                       printk(KERN_WARNING "CTLX[%d] error: state(%s)\n",
                                         hfa384x2host_16(ctlx->outbuf.type),
                                         ctlxstr(ctlx->state));
                        result = -EIO;
@@ -1791,7 +1510,6 @@ static int hfa384x_usbctlx_complete_sync(hfa384x_t *hw,
                kfree(ctlx);
        }
 
-       DBFEXIT;
        return result;
 }
 
@@ -1839,7 +1557,6 @@ hfa384x_docmd(
        int                     result;
        hfa384x_usbctlx_t       *ctlx;
 
-       DBFENTER;
        ctlx = usbctlx_alloc();
        if ( ctlx == NULL ) {
                result = -ENOMEM;
@@ -1880,7 +1597,6 @@ hfa384x_docmd(
        }
 
 done:
-       DBFEXIT;
        return result;
 }
 
@@ -1925,9 +1641,9 @@ static int
 hfa384x_dorrid(
        hfa384x_t *hw,
        CMD_MODE mode,
-       UINT16  rid,
+       u16     rid,
        void    *riddata,
-       UINT    riddatalen,
+       unsigned int    riddatalen,
         ctlx_cmdcb_t cmdcb,
        ctlx_usercb_t usercb,
        void    *usercb_data)
@@ -1935,7 +1651,6 @@ hfa384x_dorrid(
        int                     result;
        hfa384x_usbctlx_t       *ctlx;
 
-       DBFENTER;
        ctlx = usbctlx_alloc();
        if ( ctlx == NULL ) {
                result = -ENOMEM;
@@ -1970,7 +1685,6 @@ hfa384x_dorrid(
        }
 
 done:
-       DBFEXIT;
        return result;
 }
 
@@ -2011,9 +1725,9 @@ static int
 hfa384x_dowrid(
        hfa384x_t *hw,
        CMD_MODE mode,
-       UINT16  rid,
+       u16     rid,
        void    *riddata,
-       UINT    riddatalen,
+       unsigned int    riddatalen,
        ctlx_cmdcb_t cmdcb,
        ctlx_usercb_t usercb,
        void    *usercb_data)
@@ -2021,7 +1735,6 @@ hfa384x_dowrid(
        int                     result;
        hfa384x_usbctlx_t       *ctlx;
 
-       DBFENTER;
        ctlx = usbctlx_alloc();
        if ( ctlx == NULL ) {
                result = -ENOMEM;
@@ -2063,7 +1776,6 @@ hfa384x_dowrid(
        }
 
 done:
-       DBFEXIT;
        return result;
 }
 
@@ -2104,10 +1816,10 @@ static int
 hfa384x_dormem(
        hfa384x_t *hw,
        CMD_MODE mode,
-       UINT16  page,
-       UINT16  offset,
+       u16     page,
+       u16     offset,
        void    *data,
-       UINT    len,
+       unsigned int    len,
        ctlx_cmdcb_t cmdcb,
        ctlx_usercb_t usercb,
        void    *usercb_data)
@@ -2115,7 +1827,6 @@ hfa384x_dormem(
        int                     result;
        hfa384x_usbctlx_t       *ctlx;
 
-       DBFENTER;
        ctlx = usbctlx_alloc();
        if ( ctlx == NULL ) {
                result = -ENOMEM;
@@ -2162,7 +1873,6 @@ hfa384x_dormem(
        }
 
 done:
-       DBFEXIT;
        return result;
 }
 
@@ -2205,10 +1915,10 @@ static int
 hfa384x_dowmem(
        hfa384x_t *hw,
        CMD_MODE mode,
-       UINT16  page,
-       UINT16  offset,
+       u16     page,
+       u16     offset,
        void    *data,
-       UINT    len,
+       unsigned int    len,
        ctlx_cmdcb_t cmdcb,
        ctlx_usercb_t usercb,
        void    *usercb_data)
@@ -2216,7 +1926,6 @@ hfa384x_dowmem(
        int                     result;
        hfa384x_usbctlx_t       *ctlx;
 
-       DBFENTER;
        WLAN_LOG_DEBUG(5, "page=0x%04x offset=0x%04x len=%d\n",
                page,offset,len);
 
@@ -2263,7 +1972,6 @@ hfa384x_dowmem(
        }
 
 done:
-       DBFEXIT;
        return result;
 }
 
@@ -2289,8 +1997,6 @@ int hfa384x_drvr_commtallies( hfa384x_t *hw )
 {
        hfa384x_metacmd_t cmd;
 
-       DBFENTER;
-
        cmd.cmd = HFA384x_CMDCODE_INQ;
        cmd.parm0 = HFA384x_IT_COMMTALLIES;
        cmd.parm1 = 0;
@@ -2298,7 +2004,6 @@ int hfa384x_drvr_commtallies( hfa384x_t *hw )
 
        hfa384x_docmd_async(hw, &cmd, NULL, NULL, NULL);
 
-       DBFEXIT;
        return 0;
 }
 
@@ -2325,11 +2030,10 @@ int hfa384x_drvr_commtallies( hfa384x_t *hw )
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_drvr_disable(hfa384x_t *hw, UINT16 macport)
+int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport)
 {
        int     result = 0;
 
-       DBFENTER;
        if ((!hw->isap && macport != 0) ||
            (hw->isap && !(macport <= HFA384x_PORTID_MAX)) ||
            !(hw->port_enabled[macport]) ){
@@ -2340,7 +2044,6 @@ int hfa384x_drvr_disable(hfa384x_t *hw, UINT16 macport)
                        hw->port_enabled[macport] = 0;
                }
        }
-       DBFEXIT;
        return result;
 }
 
@@ -2367,11 +2070,10 @@ int hfa384x_drvr_disable(hfa384x_t *hw, UINT16 macport)
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_drvr_enable(hfa384x_t *hw, UINT16 macport)
+int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport)
 {
        int     result = 0;
 
-       DBFENTER;
        if ((!hw->isap && macport != 0) ||
            (hw->isap && !(macport <= HFA384x_PORTID_MAX)) ||
            (hw->port_enabled[macport]) ){
@@ -2382,7 +2084,6 @@ int hfa384x_drvr_enable(hfa384x_t *hw, UINT16 macport)
                        hw->port_enabled[macport] = 1;
                }
        }
-       DBFEXIT;
        return result;
 }
 
@@ -2413,7 +2114,6 @@ int hfa384x_drvr_flashdl_enable(hfa384x_t *hw)
        int             result = 0;
        int             i;
 
-       DBFENTER;
        /* Check that a port isn't active */
        for ( i = 0; i < HFA384x_PORTID_MAX; i++) {
                if ( hw->port_enabled[i] ) {
@@ -2444,7 +2144,7 @@ int hfa384x_drvr_flashdl_enable(hfa384x_t *hw)
        WLAN_LOG_DEBUG(1,"flashdl_enable\n");
 
        hw->dlstate = HFA384x_DLSTATE_FLASHENABLED;
-       DBFEXIT;
+
        return result;
 }
 
@@ -2470,7 +2170,6 @@ int hfa384x_drvr_flashdl_enable(hfa384x_t *hw)
 ----------------------------------------------------------------*/
 int hfa384x_drvr_flashdl_disable(hfa384x_t *hw)
 {
-       DBFENTER;
        /* Check that we're already in the download state */
        if ( hw->dlstate != HFA384x_DLSTATE_FLASHENABLED ) {
                return -EINVAL;
@@ -2483,7 +2182,6 @@ int hfa384x_drvr_flashdl_disable(hfa384x_t *hw)
        hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0);
        hw->dlstate = HFA384x_DLSTATE_DISABLED;
 
-       DBFEXIT;
        return 0;
 }
 
@@ -2520,26 +2218,25 @@ int hfa384x_drvr_flashdl_disable(hfa384x_t *hw)
 int
 hfa384x_drvr_flashdl_write(
        hfa384x_t       *hw,
-       UINT32          daddr,
+       u32             daddr,
        void            *buf,
-       UINT32          len)
+       u32             len)
 {
        int             result = 0;
-       UINT32          dlbufaddr;
+       u32             dlbufaddr;
        int             nburns;
-       UINT32          burnlen;
-       UINT32          burndaddr;
-       UINT16          burnlo;
-       UINT16          burnhi;
+       u32             burnlen;
+       u32             burndaddr;
+       u16             burnlo;
+       u16             burnhi;
        int             nwrites;
-       UINT8           *writebuf;
-       UINT16          writepage;
-       UINT16          writeoffset;
-       UINT32          writelen;
+       u8              *writebuf;
+       u16             writepage;
+       u16             writeoffset;
+       u32             writelen;
        int             i;
        int             j;
 
-       DBFENTER;
        WLAN_LOG_DEBUG(5,"daddr=0x%08x len=%d\n", daddr, len);
 
        /* Check that we're in the flash download state */
@@ -2547,7 +2244,7 @@ hfa384x_drvr_flashdl_write(
                return -EINVAL;
        }
 
-       WLAN_LOG_INFO("Download %d bytes to flash @0x%06x\n", len, daddr);
+       printk(KERN_INFO "Download %d bytes to flash @0x%06x\n", len, daddr);
 
        /* Convert to flat address for arithmetic */
        /* NOTE: dlbuffer RID stores the address in AUX format */
@@ -2558,7 +2255,7 @@ hfa384x_drvr_flashdl_write(
                hw->bufinfo.page, hw->bufinfo.offset, dlbufaddr);
 
 #if 0
-WLAN_LOG_WARNING("dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, hw->bufinfo.len, hw->dltimeout);
+printk(KERN_WARNING "dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, hw->bufinfo.len, hw->dltimeout);
 #endif
        /* Calculations to determine how many fills of the dlbuffer to do
         * and how many USB wmemreq's to do for each fill.  At this point
@@ -2585,14 +2282,14 @@ WLAN_LOG_WARNING("dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, hw->bufinfo.len, hw-
                burnlo = HFA384x_ADDR_CMD_MKOFF(burndaddr);
                burnhi = HFA384x_ADDR_CMD_MKPAGE(burndaddr);
 
-               WLAN_LOG_INFO("Writing %d bytes to flash @0x%06x\n",
+               printk(KERN_INFO "Writing %d bytes to flash @0x%06x\n",
                        burnlen, burndaddr);
 
                /* Set the download mode */
                result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_NV,
                                burnlo, burnhi, burnlen);
                if ( result ) {
-                       WLAN_LOG_ERROR("download(NV,lo=%x,hi=%x,len=%x) "
+                       printk(KERN_ERR "download(NV,lo=%x,hi=%x,len=%x) "
                                "cmd failed, result=%d. Aborting d/l\n",
                                burnlo, burnhi, burnlen, result);
                        goto exit_proc;
@@ -2625,7 +2322,7 @@ WLAN_LOG_WARNING("dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, hw->bufinfo.len, hw-
 
 Comment out for debugging, assume the write was successful.
                        if (result) {
-                               WLAN_LOG_ERROR(
+                               printk(KERN_ERR
                                        "Write to dl buffer failed, "
                                        "result=0x%04x. Aborting.\n",
                                        result);
@@ -2640,7 +2337,7 @@ Comment out for debugging, assume the write was successful.
                                HFA384x_PROGMODE_NVWRITE,
                                0,0,0);
                if ( result ) {
-                       WLAN_LOG_ERROR(
+                       printk(KERN_ERR
                                "download(NVWRITE,lo=%x,hi=%x,len=%x) "
                                "cmd failed, result=%d. Aborting d/l\n",
                                burnlo, burnhi, burnlen, result);
@@ -2656,7 +2353,6 @@ exit_proc:
        /*  actually disable programming mode.  Remember, that will cause the */
        /*  the firmware to effectively reset itself. */
 
-       DBFEXIT;
        return result;
 }
 
@@ -2686,14 +2382,12 @@ exit_proc:
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len)
+int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len)
 {
        int                     result;
-       DBFENTER;
 
        result = hfa384x_dorrid_wait(hw, rid, buf, len);
 
-       DBFEXIT;
        return result;
 }
 
@@ -2727,7 +2421,7 @@ int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len)
 int
 hfa384x_drvr_getconfig_async(
          hfa384x_t               *hw,
-         UINT16                  rid,
+         u16                  rid,
          ctlx_usercb_t           usercb,
          void                    *usercb_data)
 {
@@ -2761,9 +2455,9 @@ hfa384x_drvr_getconfig_async(
 int
 hfa384x_drvr_setconfig_async(
          hfa384x_t       *hw,
-         UINT16          rid,
+         u16          rid,
          void            *buf,
-         UINT16          len,
+         u16          len,
          ctlx_usercb_t   usercb,
          void            *usercb_data)
 {
@@ -2790,11 +2484,9 @@ hfa384x_drvr_setconfig_async(
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_drvr_handover( hfa384x_t *hw, UINT8 *addr)
+int hfa384x_drvr_handover( hfa384x_t *hw, u8 *addr)
 {
-        DBFENTER;
-       WLAN_LOG_ERROR("Not currently supported in USB!\n");
-       DBFEXIT;
+       printk(KERN_ERR "Not currently supported in USB!\n");
        return -EIO;
 }
 
@@ -2813,98 +2505,14 @@ int hfa384x_drvr_handover( hfa384x_t *hw, UINT8 *addr)
 int hfa384x_drvr_low_level(hfa384x_t *hw, hfa384x_metacmd_t *cmd)
 {
        int             result;
-       DBFENTER;
 
        /* Do i need a host2hfa... conversion ? */
 
        result = hfa384x_docmd_wait(hw, cmd);
 
-       DBFEXIT;
        return result;
 }
 
-/*----------------------------------------------------------------
-* hfa384x_drvr_mmi_read
-*
-* Read mmi registers.  mmi is intersil-speak for the baseband
-* processor registers.
-*
-* Arguments:
-*       hw              device structure
-*       register        The test register to be accessed (must be even #).
-*
-* Returns:
-*       0               success
-*       >0              f/w reported error - f/w status code
-*       <0              driver reported error
-*
-* Side effects:
-*
-* Call context:
-*       process
-----------------------------------------------------------------*/
-int hfa384x_drvr_mmi_read(hfa384x_t *hw, UINT32 addr, UINT32 *resp)
-{
-#if 0
-        int             result = 0;
-        UINT16  cmd_code = (UINT16) 0x30;
-        UINT16 param = (UINT16) addr;
-        DBFENTER;
-
-        /* Do i need a host2hfa... conversion ? */
-        result = hfa384x_docmd_wait(hw, cmd_code);
-
-        DBFEXIT;
-        return result;
-#endif
-return 0;
-}
-
-/*----------------------------------------------------------------
-* hfa384x_drvr_mmi_write
-*
-* Read mmi registers.  mmi is intersil-speak for the baseband
-* processor registers.
-*
-* Arguments:
-*       hw              device structure
-*       addr            The test register to be accessed (must be even #).
-*       data            The data value to write to the register.
-*
-* Returns:
-*       0               success
-*       >0              f/w reported error - f/w status code
-*       <0              driver reported error
-*
-* Side effects:
-*
-* Call context:
-*       process
-----------------------------------------------------------------*/
-
-int
-hfa384x_drvr_mmi_write(hfa384x_t *hw, UINT32 addr, UINT32 data)
-{
-#if 0
-        int             result = 0;
-        UINT16  cmd_code = (UINT16) 0x31;
-        UINT16 param0 = (UINT16) addr;
-        UINT16 param1 = (UINT16) data;
-        DBFENTER;
-
-        WLAN_LOG_DEBUG(1,"mmi write : addr = 0x%08lx\n", addr);
-        WLAN_LOG_DEBUG(1,"mmi write : data = 0x%08lx\n", data);
-
-        /* Do i need a host2hfa... conversion ? */
-        result = hfa384x_docmd_wait(hw, cmd_code);
-
-        DBFEXIT;
-        return result;
-#endif
-return 0;
-}
-
-
 /*----------------------------------------------------------------
 * hfa384x_drvr_ramdl_disable
 *
@@ -2926,7 +2534,6 @@ return 0;
 int
 hfa384x_drvr_ramdl_disable(hfa384x_t *hw)
 {
-       DBFENTER;
        /* Check that we're already in the download state */
        if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) {
                return -EINVAL;
@@ -2939,7 +2546,6 @@ hfa384x_drvr_ramdl_disable(hfa384x_t *hw)
        hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0);
        hw->dlstate = HFA384x_DLSTATE_DISABLED;
 
-       DBFEXIT;
        return 0;
 }
 
@@ -2969,17 +2575,17 @@ hfa384x_drvr_ramdl_disable(hfa384x_t *hw)
 *      process
 ----------------------------------------------------------------*/
 int
-hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr)
+hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr)
 {
        int             result = 0;
-       UINT16          lowaddr;
-       UINT16          hiaddr;
+       u16             lowaddr;
+       u16             hiaddr;
        int             i;
-       DBFENTER;
+
        /* Check that a port isn't active */
        for ( i = 0; i < HFA384x_PORTID_MAX; i++) {
                if ( hw->port_enabled[i] ) {
-                       WLAN_LOG_ERROR(
+                       printk(KERN_ERR
                                "Can't download with a macport enabled.\n");
                        return -EINVAL;
                }
@@ -2987,7 +2593,7 @@ hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr)
 
        /* Check that we're not already in a download state */
        if ( hw->dlstate != HFA384x_DLSTATE_DISABLED ) {
-               WLAN_LOG_ERROR(
+               printk(KERN_ERR
                        "Download state not disabled.\n");
                return -EINVAL;
        }
@@ -3012,7 +2618,6 @@ hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr)
                        result);
        }
 
-       DBFEXIT;
        return result;
 }
 
@@ -3044,23 +2649,23 @@ hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr)
 *      process
 ----------------------------------------------------------------*/
 int
-hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len)
+hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void* buf, u32 len)
 {
        int             result = 0;
        int             nwrites;
-       UINT8           *data = buf;
+       u8              *data = buf;
        int             i;
-       UINT32          curraddr;
-       UINT16          currpage;
-       UINT16          curroffset;
-       UINT16          currlen;
-       DBFENTER;
+       u32             curraddr;
+       u16             currpage;
+       u16             curroffset;
+       u16             currlen;
+
        /* Check that we're in the ram download state */
        if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) {
                return -EINVAL;
        }
 
-       WLAN_LOG_INFO("Writing %d bytes to ram @0x%06x\n", len, daddr);
+       printk(KERN_INFO "Writing %d bytes to ram @0x%06x\n", len, daddr);
 
        /* How many dowmem calls?  */
        nwrites = len / HFA384x_USB_RWMEM_MAXLEN;
@@ -3089,7 +2694,6 @@ hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len)
                /* TODO: We really should have a readback. */
        }
 
-       DBFEXIT;
        return result;
 }
 
@@ -3125,21 +2729,21 @@ hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len)
 * Call context:
 *      process or non-card interrupt.
 ----------------------------------------------------------------*/
-int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
+int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len)
 {
        int             result = 0;
-       UINT16          *pda = buf;
+       u16             *pda = buf;
        int             pdaok = 0;
        int             morepdrs = 1;
        int             currpdr = 0;    /* word offset of the current pdr */
        size_t          i;
-       UINT16          pdrlen;         /* pdr length in bytes, host order */
-       UINT16          pdrcode;        /* pdr code, host order */
-       UINT16          currpage;
-       UINT16          curroffset;
+       u16             pdrlen;         /* pdr length in bytes, host order */
+       u16             pdrcode;        /* pdr code, host order */
+       u16             currpage;
+       u16             curroffset;
        struct pdaloc {
-               UINT32  cardaddr;
-               UINT16  auxctl;
+               u32     cardaddr;
+               u16     auxctl;
        } pdaloc[] =
        {
                { HFA3842_PDA_BASE,             0},
@@ -3147,8 +2751,6 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
                { HFA3841_PDA_BOGUS_BASE,       0}
        };
 
-       DBFENTER;
-
        /* Read the pda from each known address.  */
        for ( i = 0; i < ARRAY_SIZE(pdaloc); i++) {
                /* Make address */
@@ -3162,7 +2764,7 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
                        len);           /* units of bytes */
 
                if (result) {
-                       WLAN_LOG_WARNING(
+                       printk(KERN_WARNING
                                          "Read from index %zd failed, continuing\n",
                                i );
                        continue;
@@ -3176,14 +2778,14 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
                        pdrcode = hfa384x2host_16(pda[currpdr+1]);
                        /* Test the record length */
                        if ( pdrlen > HFA384x_PDR_LEN_MAX || pdrlen == 0) {
-                               WLAN_LOG_ERROR("pdrlen invalid=%d\n",
+                               printk(KERN_ERR "pdrlen invalid=%d\n",
                                        pdrlen);
                                pdaok = 0;
                                break;
                        }
                        /* Test the code */
                        if ( !hfa384x_isgood_pdrcode(pdrcode) ) {
-                               WLAN_LOG_ERROR("pdrcode invalid=%d\n",
+                               printk(KERN_ERR "pdrcode invalid=%d\n",
                                        pdrcode);
                                pdaok = 0;
                                break;
@@ -3200,7 +2802,7 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
                        }
                }
                if ( pdaok ) {
-                       WLAN_LOG_INFO(
+                       printk(KERN_INFO
                                "PDA Read from 0x%08x in %s space.\n",
                                pdaloc[i].cardaddr,
                                pdaloc[i].auxctl == 0 ? "EXTDS" :
@@ -3217,7 +2819,6 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
                WLAN_LOG_DEBUG(3,"Failure: pda is not okay\n");
        }
 
-       DBFEXIT;
        return result;
 }
 
@@ -3243,7 +2844,7 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
 * Call context:
 *      process
 ----------------------------------------------------------------*/
-int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len)
+int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len)
 {
        return hfa384x_dowrid_wait(hw, rid, buf, len);
 }
@@ -3267,20 +2868,38 @@ int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len)
 * Call context:
 *      process
 ----------------------------------------------------------------*/
+
 int hfa384x_drvr_start(hfa384x_t *hw)
 {
-       int             result;
-       DBFENTER;
+       int             result, result1, result2;
+       u16             status;
 
        might_sleep();
 
-       if (usb_clear_halt(hw->usb, hw->endp_in)) {
-               WLAN_LOG_ERROR(
+       /* Clear endpoint stalls - but only do this if the endpoint
+        * is showing a stall status. Some prism2 cards seem to behave
+        * badly if a clear_halt is called when the endpoint is already
+        * ok
+        */
+       result = usb_get_status(hw->usb, USB_RECIP_ENDPOINT, hw->endp_in, &status);
+       if (result < 0) {
+               printk(KERN_ERR
+                       "Cannot get bulk in endpoint status.\n");
+               goto done;
+       }
+       if ((status == 1) && usb_clear_halt(hw->usb, hw->endp_in)) {
+               printk(KERN_ERR
                        "Failed to reset bulk in endpoint.\n");
        }
 
-       if (usb_clear_halt(hw->usb, hw->endp_out)) {
-               WLAN_LOG_ERROR(
+       result = usb_get_status(hw->usb, USB_RECIP_ENDPOINT, hw->endp_out, &status);
+       if (result < 0) {
+               printk(KERN_ERR
+                       "Cannot get bulk out endpoint status.\n");
+               goto done;
+       }
+       if ((status == 1) && usb_clear_halt(hw->usb, hw->endp_out)) {
+               printk(KERN_ERR
                        "Failed to reset bulk out endpoint.\n");
        }
 
@@ -3290,26 +2909,48 @@ int hfa384x_drvr_start(hfa384x_t *hw)
        /* Post the IN urb */
        result = submit_rx_urb(hw, GFP_KERNEL);
        if (result != 0) {
-               WLAN_LOG_ERROR(
+               printk(KERN_ERR
                        "Fatal, failed to submit RX URB, result=%d\n",
                        result);
                goto done;
        }
 
-       /* call initialize */
-       result = hfa384x_cmd_initialize(hw);
-       if (result != 0) {
-               usb_kill_urb(&hw->rx_urb);
-               WLAN_LOG_ERROR(
-                       "cmd_initialize() failed, result=%d\n",
-                       result);
-               goto done;
+       /* Call initialize twice, with a 1 second sleep in between.
+        * This is a nasty work-around since many prism2 cards seem to
+        * need time to settle after an init from cold. The second
+        * call to initialize in theory is not necessary - but we call
+        * it anyway as a double insurance policy:
+        * 1) If the first init should fail, the second may well succeed
+        *    and the card can still be used
+        * 2) It helps ensures all is well with the card after the first
+        *    init and settle time.
+        */
+       result1 = hfa384x_cmd_initialize(hw);
+       msleep(1000);
+       result = result2 = hfa384x_cmd_initialize(hw);
+       if (result1 != 0) {
+               if (result2 != 0) {
+                       printk(KERN_ERR
+                               "cmd_initialize() failed on two attempts, results %d and %d\n",
+                               result1, result2);
+                       usb_kill_urb(&hw->rx_urb);
+                       goto done;
+               } else {
+                       WLAN_LOG_DEBUG(0, "First cmd_initialize() failed (result %d),\n",
+                               result1);
+                       WLAN_LOG_DEBUG(0, "but second attempt succeeded. All should be ok\n");
+               }
+       } else if (result2 != 0) {
+               printk(KERN_WARNING
+                       "First cmd_initialize() succeeded, but second attempt failed (result=%d)\n",
+                       result2);
+               printk(KERN_WARNING "Most likely the card will be functional\n");
+                       goto done;
        }
 
        hw->state = HFA384x_STATE_RUNNING;
 
 done:
-       DBFEXIT;
        return result;
 }
 
@@ -3338,7 +2979,6 @@ hfa384x_drvr_stop(hfa384x_t *hw)
 {
        int     result = 0;
        int     i;
-       DBFENTER;
 
        might_sleep();
 
@@ -3363,7 +3003,6 @@ hfa384x_drvr_stop(hfa384x_t *hw)
                hw->port_enabled[i] = 0;
        }
 
-       DBFEXIT;
        return result;
 }
 
@@ -3396,10 +3035,8 @@ int hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, p80211_hdr_t *p8021
        int             ret;
        char            *ptr;
 
-       DBFENTER;
-
        if (hw->tx_urb.status == -EINPROGRESS) {
-               WLAN_LOG_WARNING("TX URB already in use\n");
+               printk(KERN_WARNING "TX URB already in use\n");
                result = 3;
                goto exit;
        }
@@ -3475,13 +3112,12 @@ int hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, p80211_hdr_t *p8021
        result = 1;
        ret = submit_tx_urb(hw, &hw->tx_urb, GFP_ATOMIC);
        if ( ret != 0 ) {
-               WLAN_LOG_ERROR(
+               printk(KERN_ERR
                        "submit_tx_urb() failed, error=%d\n", ret);
                result = 3;
        }
 
  exit:
-       DBFEXIT;
        return result;
 }
 
@@ -3490,8 +3126,6 @@ void hfa384x_tx_timeout(wlandevice_t *wlandev)
        hfa384x_t       *hw = wlandev->priv;
        unsigned long flags;
 
-       DBFENTER;
-
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
 
        if ( !hw->wlandev->hwremoved &&
@@ -3503,8 +3137,6 @@ void hfa384x_tx_timeout(wlandevice_t *wlandev)
        }
 
        spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
-
-       DBFEXIT;
 }
 
 /*----------------------------------------------------------------
@@ -3527,8 +3159,6 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data)
        struct list_head *temp;
        unsigned long   flags;
 
-       DBFENTER;
-
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
 
        /* This list is guaranteed to be empty if someone
@@ -3544,7 +3174,6 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data)
 
        spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
 
-       DBFEXIT;
 }
 
 /*----------------------------------------------------------------
@@ -3570,8 +3199,6 @@ static void hfa384x_usbctlx_completion_task(unsigned long data)
 
        int reap = 0;
 
-       DBFENTER;
-
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
 
        /* This list is guaranteed to be empty if someone
@@ -3626,8 +3253,6 @@ static void hfa384x_usbctlx_completion_task(unsigned long data)
 
        if (reap)
                tasklet_schedule(&hw->reaper_bh);
-
-       DBFEXIT;
 }
 
 /*----------------------------------------------------------------
@@ -3651,8 +3276,6 @@ static int unlocked_usbctlx_cancel_async(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
 {
        int ret;
 
-       DBFENTER;
-
        /*
         * Try to delete the URB containing our request packet.
         * If we succeed, then its completion handler will be
@@ -3673,8 +3296,6 @@ static int unlocked_usbctlx_cancel_async(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
                ret = 0;
        }
 
-       DBFEXIT;
-
        return ret;
 }
 
@@ -3702,8 +3323,6 @@ static int unlocked_usbctlx_cancel_async(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
 ----------------------------------------------------------------*/
 static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
 {
-       DBFENTER;
-
        /* Timers have been stopped, and ctlx should be in
         * a terminal state. Retire it from the "active"
         * queue.
@@ -3718,13 +3337,11 @@ static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
                break;
 
        default:
-               WLAN_LOG_ERROR("CTLX[%d] not in a terminating state(%s)\n",
+               printk(KERN_ERR "CTLX[%d] not in a terminating state(%s)\n",
                               hfa384x2host_16(ctlx->outbuf.type),
                               ctlxstr(ctlx->state));
                break;
        } /* switch */
-
-       DBFEXIT;
 }
 
 /*----------------------------------------------------------------
@@ -3747,7 +3364,6 @@ static void
 hfa384x_usbctlxq_run(hfa384x_t *hw)
 {
        unsigned long           flags;
-       DBFENTER;
 
        /* acquire lock */
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
@@ -3807,7 +3423,7 @@ hfa384x_usbctlxq_run(hfa384x_t    *hw)
                         * this CTLX back in the "pending" queue
                         * and schedule a reset ...
                         */
-                       WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n",
+                       printk(KERN_WARNING "%s tx pipe stalled: requesting reset\n",
                                         hw->wlandev->netdev->name);
                        list_move(&head->list, &hw->ctlxq.pending);
                        set_bit(WORK_TX_HALT, &hw->usb_flags);
@@ -3816,20 +3432,18 @@ hfa384x_usbctlxq_run(hfa384x_t  *hw)
                }
 
                if (result == -ESHUTDOWN) {
-                       WLAN_LOG_WARNING("%s urb shutdown!\n",
+                       printk(KERN_WARNING "%s urb shutdown!\n",
                                         hw->wlandev->netdev->name);
                        break;
                }
 
-               WLAN_LOG_ERROR("Failed to submit CTLX[%d]: error=%d\n",
+               printk(KERN_ERR "Failed to submit CTLX[%d]: error=%d\n",
                               hfa384x2host_16(head->outbuf.type), result);
                unlocked_usbctlx_complete(hw, head);
        } /* while */
 
        unlock:
        spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
-
-       DBFEXIT;
 }
 
 
@@ -3849,11 +3463,7 @@ hfa384x_usbctlxq_run(hfa384x_t   *hw)
 * Call context:
 *      interrupt
 ----------------------------------------------------------------*/
-#ifdef URB_ONLY_CALLBACK
 static void hfa384x_usbin_callback(struct urb *urb)
-#else
-static void hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs)
-#endif
 {
        wlandevice_t            *wlandev = urb->context;
        hfa384x_t               *hw;
@@ -3861,7 +3471,7 @@ static void hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs)
        struct sk_buff          *skb = NULL;
        int                     result;
        int                     urb_status;
-       UINT16                  type;
+       u16                     type;
 
        enum USBIN_ACTION {
                HANDLE,
@@ -3869,11 +3479,9 @@ static void hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs)
                ABORT
        } action;
 
-       DBFENTER;
-
        if ( !wlandev ||
             !wlandev->netdev ||
-            !netif_device_present(wlandev->netdev) )
+            wlandev->hwremoved )
                goto exit;
 
        hw = wlandev->priv;
@@ -3900,7 +3508,7 @@ static void hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs)
                break;
 
        case -EPIPE:
-               WLAN_LOG_WARNING("%s rx pipe stalled: requesting reset\n",
+               printk(KERN_WARNING "%s rx pipe stalled: requesting reset\n",
                                 wlandev->netdev->name);
                if ( !test_and_set_bit(WORK_RX_HALT, &hw->usb_flags) )
                        schedule_work(&hw->usb_work);
@@ -3951,7 +3559,7 @@ static void hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs)
                result = submit_rx_urb(hw, GFP_ATOMIC);
 
                if (result != 0) {
-                       WLAN_LOG_ERROR(
+                       printk(KERN_ERR
                                "Fatal, failed to resubmit rx_urb. error=%d\n",
                                result);
                }
@@ -4016,8 +3624,6 @@ exit:
 
        if (skb)
                dev_kfree_skb(skb);
-
-       DBFEXIT;
 }
 
 
@@ -4048,8 +3654,6 @@ static void hfa384x_usbin_ctlx(hfa384x_t *hw, hfa384x_usbin_t *usbin,
        int                     run_queue = 0;
        unsigned long           flags;
 
-       DBFENTER;
-
 retry:
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
 
@@ -4088,13 +3692,13 @@ retry:
                if (unlocked_usbctlx_cancel_async(hw, ctlx) == 0)
                        run_queue = 1;
        } else {
-               const UINT16 intype = (usbin->type&~host2hfa384x_16(0x8000));
+               const u16 intype = (usbin->type&~host2hfa384x_16(0x8000));
 
                /*
                 * Check that our message is what we're expecting ...
                 */
                if (ctlx->outbuf.type != intype) {
-                       WLAN_LOG_WARNING("Expected IN[%d], received IN[%d] - ignored.\n",
+                       printk(KERN_WARNING "Expected IN[%d], received IN[%d] - ignored.\n",
                                         hfa384x2host_16(ctlx->outbuf.type),
                                         hfa384x2host_16(intype));
                        goto unlock;
@@ -4129,7 +3733,7 @@ retry:
                        /*
                         * Throw this CTLX away ...
                         */
-                       WLAN_LOG_ERROR("Matched IN URB, CTLX[%d] in invalid state(%s)."
+                       printk(KERN_ERR "Matched IN URB, CTLX[%d] in invalid state(%s)."
                                       " Discarded.\n",
                                       hfa384x2host_16(ctlx->outbuf.type),
                                       ctlxstr(ctlx->state));
@@ -4144,8 +3748,6 @@ unlock:
 
        if (run_queue)
                hfa384x_usbctlxq_run(hw);
-
-       DBFEXIT;
 }
 
 
@@ -4168,8 +3770,7 @@ unlock:
 ----------------------------------------------------------------*/
 static void hfa384x_usbin_txcompl(wlandevice_t *wlandev, hfa384x_usbin_t *usbin)
 {
-       UINT16                  status;
-       DBFENTER;
+       u16                     status;
 
        status = hfa384x2host_16(usbin->type); /* yeah I know it says type...*/
 
@@ -4180,8 +3781,6 @@ static void hfa384x_usbin_txcompl(wlandevice_t *wlandev, hfa384x_usbin_t *usbin)
                prism2sta_ev_tx(wlandev, status);
        }
        // prism2sta_ev_alloc(wlandev);
-
-       DBFEXIT;
 }
 
 
@@ -4208,10 +3807,8 @@ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb)
        hfa384x_t               *hw = wlandev->priv;
        int                     hdrlen;
        p80211_rxmeta_t         *rxmeta;
-       UINT16                  data_len;
-       UINT16                  fc;
-
-       DBFENTER;
+       u16                  data_len;
+       u16                  fc;
 
        /* Byte order convert once up front. */
        usbin->rxfrm.desc.status =
@@ -4223,7 +3820,7 @@ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb)
        switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) )
        {
        case 0:
-               fc = ieee2host16(usbin->rxfrm.desc.frame_control);
+               fc = le16_to_cpu(usbin->rxfrm.desc.frame_control);
 
                /* If exclude and we receive an unencrypted, drop it */
                if ( (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) &&
@@ -4280,14 +3877,13 @@ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb)
                break;
 
        default:
-               WLAN_LOG_WARNING("Received frame on unsupported port=%d\n",
+               printk(KERN_WARNING "Received frame on unsupported port=%d\n",
                        HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) );
                goto done;
                break;
        }
 
 done:
-       DBFEXIT;
        return;
 }
 
@@ -4315,102 +3911,40 @@ done:
 static void hfa384x_int_rxmonitor( wlandevice_t *wlandev, hfa384x_usb_rxfrm_t *rxfrm)
 {
        hfa384x_rx_frame_t              *rxdesc = &(rxfrm->desc);
-       UINT                            hdrlen = 0;
-       UINT                            datalen = 0;
-       UINT                            skblen = 0;
-       p80211msg_lnxind_wlansniffrm_t  *msg;
-       UINT8                           *datap;
-       UINT16                          fc;
+       unsigned int                            hdrlen = 0;
+       unsigned int                            datalen = 0;
+       unsigned int                            skblen = 0;
+       u8                              *datap;
+       u16                             fc;
        struct sk_buff                  *skb;
        hfa384x_t                       *hw = wlandev->priv;
 
-
-       DBFENTER;
        /* Don't forget the status, time, and data_len fields are in host order */
        /* Figure out how big the frame is */
-       fc = ieee2host16(rxdesc->frame_control);
+       fc = le16_to_cpu(rxdesc->frame_control);
        hdrlen = p80211_headerlen(fc);
        datalen = hfa384x2host_16(rxdesc->data_len);
 
        /* Allocate an ind message+framesize skb */
-       skblen = sizeof(p80211msg_lnxind_wlansniffrm_t) +
+       skblen = sizeof(p80211_caphdr_t) +
                hdrlen + datalen + WLAN_CRC_LEN;
 
        /* sanity check the length */
        if ( skblen >
-               (sizeof(p80211msg_lnxind_wlansniffrm_t) +
-               WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) ) {
+            (sizeof(p80211_caphdr_t) +
+             WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) ) {
                WLAN_LOG_DEBUG(1, "overlen frm: len=%zd\n",
-                       skblen - sizeof(p80211msg_lnxind_wlansniffrm_t));
+                              skblen - sizeof(p80211_caphdr_t));
        }
 
        if ( (skb = dev_alloc_skb(skblen)) == NULL ) {
-               WLAN_LOG_ERROR("alloc_skb failed trying to allocate %d bytes\n", skblen);
+               printk(KERN_ERR "alloc_skb failed trying to allocate %d bytes\n", skblen);
                return;
        }
 
        /* only prepend the prism header if in the right mode */
        if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) &&
-           (hw->sniffhdr == 0)) {
-               datap = skb_put(skb, sizeof(p80211msg_lnxind_wlansniffrm_t));
-               msg = (p80211msg_lnxind_wlansniffrm_t*) datap;
-
-               /* Initialize the message members */
-               msg->msgcode = DIDmsg_lnxind_wlansniffrm;
-               msg->msglen = sizeof(p80211msg_lnxind_wlansniffrm_t);
-               strcpy(msg->devname, wlandev->name);
-
-               msg->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime;
-               msg->hosttime.status = 0;
-               msg->hosttime.len = 4;
-               msg->hosttime.data = jiffies;
-
-               msg->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime;
-               msg->mactime.status = 0;
-               msg->mactime.len = 4;
-               msg->mactime.data = rxdesc->time;
-
-               msg->channel.did = DIDmsg_lnxind_wlansniffrm_channel;
-               msg->channel.status = 0;
-               msg->channel.len = 4;
-               msg->channel.data = hw->sniff_channel;
-
-               msg->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi;
-               msg->rssi.status = P80211ENUM_msgitem_status_no_value;
-               msg->rssi.len = 4;
-               msg->rssi.data = 0;
-
-               msg->sq.did = DIDmsg_lnxind_wlansniffrm_sq;
-               msg->sq.status = P80211ENUM_msgitem_status_no_value;
-               msg->sq.len = 4;
-               msg->sq.data = 0;
-
-               msg->signal.did = DIDmsg_lnxind_wlansniffrm_signal;
-               msg->signal.status = 0;
-               msg->signal.len = 4;
-               msg->signal.data = rxdesc->signal;
-
-               msg->noise.did = DIDmsg_lnxind_wlansniffrm_noise;
-               msg->noise.status = 0;
-               msg->noise.len = 4;
-               msg->noise.data = rxdesc->silence;
-
-               msg->rate.did = DIDmsg_lnxind_wlansniffrm_rate;
-               msg->rate.status = 0;
-               msg->rate.len = 4;
-               msg->rate.data = rxdesc->rate / 5; /* set to 802.11 units */
-
-               msg->istx.did = DIDmsg_lnxind_wlansniffrm_istx;
-               msg->istx.status = 0;
-               msg->istx.len = 4;
-               msg->istx.data = P80211ENUM_truth_false;
-
-               msg->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen;
-               msg->frmlen.status = 0;
-               msg->frmlen.len = 4;
-               msg->frmlen.data = hdrlen + datalen + WLAN_CRC_LEN;
-       } else if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) &&
-                  (hw->sniffhdr != 0)) {
+           (hw->sniffhdr != 0)) {
                p80211_caphdr_t         *caphdr;
                /* The NEW header format! */
                datap = skb_put(skb, sizeof(p80211_caphdr_t));
@@ -4457,7 +3991,6 @@ static void hfa384x_int_rxmonitor( wlandevice_t *wlandev, hfa384x_usb_rxfrm_t *r
        /* pass it back up */
        prism2sta_ev_rx(wlandev, skb);
 
-       DBFEXIT;
        return;
 }
 
@@ -4482,12 +4015,8 @@ static void hfa384x_int_rxmonitor( wlandevice_t *wlandev, hfa384x_usb_rxfrm_t *r
 ----------------------------------------------------------------*/
 static void hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin)
 {
-       DBFENTER;
-
        usbin->infofrm.info.framelen = hfa384x2host_16(usbin->infofrm.info.framelen);
        prism2sta_ev_info(wlandev, &usbin->infofrm.info);
-
-       DBFEXIT;
 }
 
 
@@ -4508,15 +4037,10 @@ static void hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin)
 * Call context:
 *      interrupt
 ----------------------------------------------------------------*/
-#ifdef URB_ONLY_CALLBACK
 static void hfa384x_usbout_callback(struct urb *urb)
-#else
-static void hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs)
-#endif
 {
        wlandevice_t            *wlandev = urb->context;
        hfa384x_usbout_t        *usbout = urb->transfer_buffer;
-       DBFENTER;
 
 #ifdef DEBUG_USB
        dbprint_urb(urb);
@@ -4533,7 +4057,7 @@ static void hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs)
                case -EPIPE:
                {
                        hfa384x_t *hw = wlandev->priv;
-                       WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n",
+                       printk(KERN_WARNING "%s tx pipe stalled: requesting reset\n",
                                         wlandev->netdev->name);
                        if ( !test_and_set_bit(WORK_TX_HALT, &hw->usb_flags) )
                                schedule_work(&hw->usb_work);
@@ -4563,13 +4087,11 @@ static void hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs)
                        break;
 
                default:
-                       WLAN_LOG_INFO("unknown urb->status=%d\n", urb->status);
+                       printk(KERN_INFO "unknown urb->status=%d\n", urb->status);
                        ++(wlandev->linux_stats.tx_errors);
                        break;
                } /* switch */
        }
-
-       DBFEXIT;
 }
 
 
@@ -4589,11 +4111,7 @@ static void hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs)
 * Call context:
 * interrupt
 ----------------------------------------------------------------*/
-#ifdef URB_ONLY_CALLBACK
 static void hfa384x_ctlxout_callback(struct urb *urb)
-#else
-static void hfa384x_ctlxout_callback(struct urb *urb, struct pt_regs *regs)
-#endif
 {
        hfa384x_t       *hw = urb->context;
        int             delete_resptimer = 0;
@@ -4602,8 +4120,6 @@ static void hfa384x_ctlxout_callback(struct urb *urb, struct pt_regs *regs)
        hfa384x_usbctlx_t       *ctlx;
        unsigned long   flags;
 
-       DBFENTER;
-
        WLAN_LOG_DEBUG(3,"urb->status=%d\n", urb->status);
 #ifdef DEBUG_USB
        dbprint_urb(urb);
@@ -4667,7 +4183,7 @@ retry:
 
                default:
                        /* This is NOT a valid CTLX "success" state! */
-                       WLAN_LOG_ERROR(
+                       printk(KERN_ERR
                            "Illegal CTLX[%d] success state(%s, %d) in OUT URB\n",
                            hfa384x2host_16(ctlx->outbuf.type),
                            ctlxstr(ctlx->state), urb->status);
@@ -4677,7 +4193,7 @@ retry:
                /* If the pipe has stalled then we need to reset it */
                if ( (urb->status == -EPIPE) &&
                      !test_and_set_bit(WORK_TX_HALT, &hw->usb_flags) ) {
-                       WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n",
+                       printk(KERN_WARNING "%s tx pipe stalled: requesting reset\n",
                                         hw->wlandev->netdev->name);
                        schedule_work(&hw->usb_work);
                }
@@ -4709,7 +4225,7 @@ retry:
                hfa384x_usbctlxq_run(hw);
 
  done:
-       DBFEXIT;
+        ;
 }
 
 
@@ -4736,7 +4252,6 @@ hfa384x_usbctlx_reqtimerfn(unsigned long data)
 {
        hfa384x_t       *hw = (hfa384x_t*)data;
        unsigned long   flags;
-       DBFENTER;
 
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
 
@@ -4773,8 +4288,6 @@ hfa384x_usbctlx_reqtimerfn(unsigned long data)
        }
 
        spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
-
-       DBFEXIT;
 }
 
 
@@ -4802,8 +4315,6 @@ hfa384x_usbctlx_resptimerfn(unsigned long data)
        hfa384x_t *hw = (hfa384x_t*)data;
        unsigned long   flags;
 
-       DBFENTER;
-
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
 
        hw->resp_timer_done = 1;
@@ -4826,7 +4337,8 @@ hfa384x_usbctlx_resptimerfn(unsigned long data)
        spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
 
  done:
-       DBFEXIT;
+        ;
+
 }
 
 /*----------------------------------------------------------------
@@ -4850,8 +4362,6 @@ hfa384x_usb_throttlefn(unsigned long data)
        hfa384x_t *hw = (hfa384x_t*)data;
        unsigned long   flags;
 
-       DBFENTER;
-
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
 
        /*
@@ -4872,8 +4382,6 @@ hfa384x_usb_throttlefn(unsigned long data)
        }
 
        spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
-
-       DBFEXIT;
 }
 
 
@@ -4903,8 +4411,6 @@ hfa384x_usbctlx_submit(
        unsigned long flags;
        int ret;
 
-       DBFENTER;
-
        spin_lock_irqsave(&hw->ctlxq.lock, flags);
 
        if (hw->wlandev->hwremoved) {
@@ -4919,7 +4425,6 @@ hfa384x_usbctlx_submit(
                ret = 0;
        }
 
-       DBFEXIT;
        return ret;
 }
 
@@ -4945,11 +4450,7 @@ hfa384x_usbctlx_submit(
 ----------------------------------------------------------------*/
 static void hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout)
 {
-       DBFENTER;
-
        prism2sta_ev_alloc(wlandev);
-
-       DBFEXIT;
 }
 
 /*----------------------------------------------------------------
@@ -4969,7 +4470,7 @@ static void hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout)
 * Call context:
 ----------------------------------------------------------------*/
 static int
-hfa384x_isgood_pdrcode(UINT16 pdrcode)
+hfa384x_isgood_pdrcode(u16 pdrcode)
 {
        switch(pdrcode) {
        case HFA384x_PDR_END_OF_PDA: