]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/staging/wlan-ng/prism2sta.c
Merge branch 'omap-pool'
[linux-2.6-omap-h63xx.git] / drivers / staging / wlan-ng / prism2sta.c
index b279c97cbc025d8b1584c67577189c452d55fe95..9d57f82f4a25dba74338080825af39a128cdb08c 100644 (file)
 * --------------------------------------------------------------------
 */
 
-/*================================================================*/
-/* System Includes */
-#define WLAN_DBVAR     prism2_debug
-
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/wireless.h>
 #include <linux/netdevice.h>
 #include <linux/workqueue.h>
+#include <linux/byteorder/generic.h>
+#include <linux/ctype.h>
 
 #include <asm/io.h>
 #include <linux/delay.h>
 #include <asm/byteorder.h>
 #include <linux/if_arp.h>
-
-#include "wlan_compat.h"
+#include <linux/if_ether.h>
+#include <linux/bitops.h>
 
 /*================================================================*/
 /* Project Includes */
 #include "hfa384x.h"
 #include "prism2mgmt.h"
 
-/*================================================================*/
-/* Local Constants */
-
-/*================================================================*/
-/* Local Macros */
-
-/*================================================================*/
-/* Local Types */
-
-/*================================================================*/
-/* Local Static Definitions */
+#define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
+
+/* Create a string of printable chars from something that might not be */
+/* It's recommended that the str be 4*len + 1 bytes long */
+#define wlan_mkprintstr(buf, buflen, str, strlen) \
+{ \
+       int i = 0; \
+       int j = 0; \
+       memset(str, 0, (strlen)); \
+       for (i = 0; i < (buflen); i++) { \
+               if (isprint((buf)[i])) { \
+                       (str)[j] = (buf)[i]; \
+                       j++; \
+               } else { \
+                       (str)[j] = '\\'; \
+                       (str)[j+1] = 'x'; \
+                       (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
+                       (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
+                       j += 4; \
+               } \
+       } \
+}
 
 static char *dev_info = "prism2_usb";
-
 static wlandevice_t *create_wlan(void);
 
-/*----------------------------------------------------------------*/
-/* --Module Parameters */
+int prism2_reset_holdtime = 30;        /* Reset hold time in ms */
+int prism2_reset_settletime = 100;     /* Reset settle time in ms */
 
-int      prism2_reset_holdtime=30;     /* Reset hold time in ms */
-int     prism2_reset_settletime=100;   /* Reset settle time in ms */
+static int prism2_doreset = 0; /* Do a reset at init? */
 
-static int     prism2_doreset=0;               /* Do a reset at init? */
-
-#ifdef WLAN_INCLUDE_DEBUG
-int prism2_debug=0;
-module_param( prism2_debug, int, 0644);
-MODULE_PARM_DESC(prism2_debug, "prism2 debugging");
-#endif
-
-module_param( prism2_doreset, int, 0644);
+module_param(prism2_doreset, int, 0644);
 MODULE_PARM_DESC(prism2_doreset, "Issue a reset on initialization");
 
-module_param( prism2_reset_holdtime, int, 0644);
-MODULE_PARM_DESC( prism2_reset_holdtime, "reset hold time in ms");
-module_param( prism2_reset_settletime, int, 0644);
-MODULE_PARM_DESC( prism2_reset_settletime, "reset settle time in ms");
+module_param(prism2_reset_holdtime, int, 0644);
+MODULE_PARM_DESC(prism2_reset_holdtime, "reset hold time in ms");
+module_param(prism2_reset_settletime, int, 0644);
+MODULE_PARM_DESC(prism2_reset_settletime, "reset settle time in ms");
 
 MODULE_LICENSE("Dual MPL/GPL");
 
-/*================================================================*/
-/* Local Function Declarations */
-
-static int     prism2sta_open(wlandevice_t *wlandev);
-static int     prism2sta_close(wlandevice_t *wlandev);
-static void    prism2sta_reset(wlandevice_t *wlandev );
-static int      prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep);
-static int     prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg);
-static int     prism2sta_getcardinfo(wlandevice_t *wlandev);
-static int     prism2sta_globalsetup(wlandevice_t *wlandev);
-static int      prism2sta_setmulticast(wlandevice_t *wlandev,
-                                      netdevice_t *dev);
-
-static void    prism2sta_inf_handover(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void    prism2sta_inf_tallies(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void     prism2sta_inf_hostscanresults(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void    prism2sta_inf_scanresults(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void    prism2sta_inf_chinforesults(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void    prism2sta_inf_linkstatus(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void    prism2sta_inf_assocstatus(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void    prism2sta_inf_authreq(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void    prism2sta_inf_authreq_defer(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-static void    prism2sta_inf_psusercnt(
-                       wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
-
-/*================================================================*/
-/* Function Definitions */
-
-/*----------------------------------------------------------------
-* dmpmem
-*
-* Debug utility function to dump memory to the kernel debug log.
-*
-* Arguments:
-*      buf     ptr data we want dumped
-*      len     length of data
-*
-* Returns:
-*      nothing
-* Side effects:
-*
-* Call context:
-*      process thread
-*      interrupt
-----------------------------------------------------------------*/
-inline void dmpmem(void *buf, int n)
-{
-       int c;
-       for ( c= 0; c < n; c++) {
-               if ( (c % 16) == 0 ) printk(KERN_DEBUG"dmp[%d]: ", c);
-               printk("%02x ", ((u8*)buf)[c]);
-               if ( (c % 16) == 15 ) printk("\n");
-       }
-       if ( (c % 16) != 0 ) printk("\n");
-}
-
+static int prism2sta_open(wlandevice_t *wlandev);
+static int prism2sta_close(wlandevice_t *wlandev);
+static void prism2sta_reset(wlandevice_t *wlandev);
+static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
+                            p80211_hdr_t *p80211_hdr,
+                            p80211_metawep_t *p80211_wep);
+static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg);
+static int prism2sta_getcardinfo(wlandevice_t *wlandev);
+static int prism2sta_globalsetup(wlandevice_t *wlandev);
+static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev);
+
+static void prism2sta_inf_handover(wlandevice_t *wlandev,
+                                  hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_tallies(wlandevice_t *wlandev,
+                                 hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
+                                         hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
+                                     hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
+                                       hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
+                                    hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
+                                     hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_authreq(wlandevice_t *wlandev,
+                                 hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
+                                       hfa384x_InfFrame_t *inf);
+static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
+                                   hfa384x_InfFrame_t *inf);
 
 /*----------------------------------------------------------------
 * prism2sta_open
@@ -217,8 +182,6 @@ inline void dmpmem(void *buf, int n)
 ----------------------------------------------------------------*/
 static int prism2sta_open(wlandevice_t *wlandev)
 {
-       DBFENTER;
-
        /* We don't currently have to do anything else.
         * The setup of the MAC should be subsequently completed via
         * the mlme commands.
@@ -227,11 +190,9 @@ static int prism2sta_open(wlandevice_t *wlandev)
         * frames because of dev->flags&IFF_UP is true.
         */
 
-       DBFEXIT;
        return 0;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_close
 *
@@ -255,19 +216,15 @@ static int prism2sta_open(wlandevice_t *wlandev)
 ----------------------------------------------------------------*/
 static int prism2sta_close(wlandevice_t *wlandev)
 {
-       DBFENTER;
-
        /* We don't currently have to do anything else.
         * Higher layers know we're not ready from dev->start==0 and
         * dev->tbusy==1.  Our rx path knows to not pass up received
         * frames because of dev->flags&IFF_UP is false.
         */
 
-       DBFEXIT;
        return 0;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_reset
 *
@@ -285,14 +242,11 @@ static int prism2sta_close(wlandevice_t *wlandev)
 * Call context:
 *      process thread
 ----------------------------------------------------------------*/
-static void prism2sta_reset(wlandevice_t *wlandev )
+static void prism2sta_reset(wlandevice_t *wlandev)
 {
-       DBFENTER;
-       DBFEXIT;
        return;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_txframe
 *
@@ -318,22 +272,20 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
                             p80211_hdr_t *p80211_hdr,
                             p80211_metawep_t *p80211_wep)
 {
-       hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       int                     result;
-       DBFENTER;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       int result;
 
        /* If necessary, set the 802.11 WEP bit */
-       if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
-               p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1));
+       if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) ==
+           HOSTWEP_PRIVACYINVOKED) {
+               p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
        }
 
        result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep);
 
-       DBFEXIT;
        return result;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_mlmerequest
 *
@@ -360,109 +312,113 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
 ----------------------------------------------------------------*/
 static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
 
        int result = 0;
-       DBFENTER;
 
-       switch( msg->msgcode )
-       {
-       case DIDmsg_dot11req_mibget :
-               WLAN_LOG_DEBUG(2,"Received mibget request\n");
+       switch (msg->msgcode) {
+       case DIDmsg_dot11req_mibget:
+               pr_debug("Received mibget request\n");
                result = prism2mgmt_mibset_mibget(wlandev, msg);
                break;
-       case DIDmsg_dot11req_mibset :
-               WLAN_LOG_DEBUG(2,"Received mibset request\n");
+       case DIDmsg_dot11req_mibset:
+               pr_debug("Received mibset request\n");
                result = prism2mgmt_mibset_mibget(wlandev, msg);
                break;
-       case DIDmsg_dot11req_scan :
-               WLAN_LOG_DEBUG(2,"Received scan request\n");
+       case DIDmsg_dot11req_scan:
+               pr_debug("Received scan request\n");
                result = prism2mgmt_scan(wlandev, msg);
                break;
-       case DIDmsg_dot11req_scan_results :
-               WLAN_LOG_DEBUG(2,"Received scan_results request\n");
+       case DIDmsg_dot11req_scan_results:
+               pr_debug("Received scan_results request\n");
                result = prism2mgmt_scan_results(wlandev, msg);
                break;
-       case DIDmsg_dot11req_start :
-               WLAN_LOG_DEBUG(2,"Received mlme start request\n");
+       case DIDmsg_dot11req_start:
+               pr_debug("Received mlme start request\n");
                result = prism2mgmt_start(wlandev, msg);
                break;
-       /*
-        * Prism2 specific messages
-        */
-               case DIDmsg_p2req_readpda :
-               WLAN_LOG_DEBUG(2,"Received mlme readpda request\n");
+               /*
+                * Prism2 specific messages
+                */
+       case DIDmsg_p2req_readpda:
+               pr_debug("Received mlme readpda request\n");
                result = prism2mgmt_readpda(wlandev, msg);
                break;
-       case DIDmsg_p2req_ramdl_state :
-               WLAN_LOG_DEBUG(2,"Received mlme ramdl_state request\n");
+       case DIDmsg_p2req_ramdl_state:
+               pr_debug("Received mlme ramdl_state request\n");
                result = prism2mgmt_ramdl_state(wlandev, msg);
                break;
-       case DIDmsg_p2req_ramdl_write :
-               WLAN_LOG_DEBUG(2,"Received mlme ramdl_write request\n");
+       case DIDmsg_p2req_ramdl_write:
+               pr_debug("Received mlme ramdl_write request\n");
                result = prism2mgmt_ramdl_write(wlandev, msg);
                break;
-       case DIDmsg_p2req_flashdl_state :
-               WLAN_LOG_DEBUG(2,"Received mlme flashdl_state request\n");
+       case DIDmsg_p2req_flashdl_state:
+               pr_debug("Received mlme flashdl_state request\n");
                result = prism2mgmt_flashdl_state(wlandev, msg);
                break;
-       case DIDmsg_p2req_flashdl_write :
-               WLAN_LOG_DEBUG(2,"Received mlme flashdl_write request\n");
+       case DIDmsg_p2req_flashdl_write:
+               pr_debug("Received mlme flashdl_write request\n");
                result = prism2mgmt_flashdl_write(wlandev, msg);
                break;
-       /*
-        * Linux specific messages
-        */
-       case DIDmsg_lnxreq_hostwep :
-               break;   // ignore me.
-        case DIDmsg_lnxreq_ifstate :
+               /*
+                * Linux specific messages
+                */
+       case DIDmsg_lnxreq_hostwep:
+               break;          /* ignore me. */
+       case DIDmsg_lnxreq_ifstate:
                {
-               p80211msg_lnxreq_ifstate_t      *ifstatemsg;
-                WLAN_LOG_DEBUG(2,"Received mlme ifstate request\n");
-               ifstatemsg = (p80211msg_lnxreq_ifstate_t*)msg;
-                result = prism2sta_ifstate(wlandev, ifstatemsg->ifstate.data);
-               ifstatemsg->resultcode.status =
-                       P80211ENUM_msgitem_status_data_ok;
-               ifstatemsg->resultcode.data = result;
-               result = 0;
+                       p80211msg_lnxreq_ifstate_t *ifstatemsg;
+                       pr_debug("Received mlme ifstate request\n");
+                       ifstatemsg = (p80211msg_lnxreq_ifstate_t *) msg;
+                       result =
+                           prism2sta_ifstate(wlandev,
+                                             ifstatemsg->ifstate.data);
+                       ifstatemsg->resultcode.status =
+                           P80211ENUM_msgitem_status_data_ok;
+                       ifstatemsg->resultcode.data = result;
+                       result = 0;
                }
-                break;
-        case DIDmsg_lnxreq_wlansniff :
-                WLAN_LOG_DEBUG(2,"Received mlme wlansniff request\n");
-                result = prism2mgmt_wlansniff(wlandev, msg);
-                break;
-       case DIDmsg_lnxreq_autojoin :
-               WLAN_LOG_DEBUG(2,"Received mlme autojoin request\n");
+               break;
+       case DIDmsg_lnxreq_wlansniff:
+               pr_debug("Received mlme wlansniff request\n");
+               result = prism2mgmt_wlansniff(wlandev, msg);
+               break;
+       case DIDmsg_lnxreq_autojoin:
+               pr_debug("Received mlme autojoin request\n");
                result = prism2mgmt_autojoin(wlandev, msg);
                break;
-       case DIDmsg_lnxreq_commsquality: {
-               p80211msg_lnxreq_commsquality_t *qualmsg;
-
-               WLAN_LOG_DEBUG(2,"Received commsquality request\n");
+       case DIDmsg_lnxreq_commsquality:{
+                       p80211msg_lnxreq_commsquality_t *qualmsg;
 
-               qualmsg = (p80211msg_lnxreq_commsquality_t*) msg;
+                       pr_debug("Received commsquality request\n");
 
-               qualmsg->link.status = P80211ENUM_msgitem_status_data_ok;
-               qualmsg->level.status = P80211ENUM_msgitem_status_data_ok;
-               qualmsg->noise.status = P80211ENUM_msgitem_status_data_ok;
+                       qualmsg = (p80211msg_lnxreq_commsquality_t *) msg;
 
+                       qualmsg->link.status =
+                           P80211ENUM_msgitem_status_data_ok;
+                       qualmsg->level.status =
+                           P80211ENUM_msgitem_status_data_ok;
+                       qualmsg->noise.status =
+                           P80211ENUM_msgitem_status_data_ok;
 
-               qualmsg->link.data = hfa384x2host_16(hw->qual.CQ_currBSS);
-               qualmsg->level.data = hfa384x2host_16(hw->qual.ASL_currBSS);
-               qualmsg->noise.data = hfa384x2host_16(hw->qual.ANL_currFC);
+                       qualmsg->link.data =
+                           le16_to_cpu(hw->qual.CQ_currBSS);
+                       qualmsg->level.data =
+                           le16_to_cpu(hw->qual.ASL_currBSS);
+                       qualmsg->noise.data =
+                           le16_to_cpu(hw->qual.ANL_currFC);
 
-               break;
-       }
+                       break;
+               }
        default:
-               WLAN_LOG_WARNING("Unknown mgmt request message 0x%08x", msg->msgcode);
+               printk(KERN_WARNING "Unknown mgmt request message 0x%08x",
+                      msg->msgcode);
                break;
        }
 
-       DBFEXIT;
        return result;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_ifstate
 *
@@ -486,16 +442,14 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg)
 ----------------------------------------------------------------*/
 u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       u32                     result;
-       DBFENTER;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       u32 result;
 
        result = P80211ENUM_resultcode_implementation_failure;
 
-       WLAN_LOG_DEBUG(2, "Current MSD state(%d), requesting(%d)\n",
-                         wlandev->msdstate, ifstate);
-       switch (ifstate)
-       {
+       pr_debug("Current MSD state(%d), requesting(%d)\n",
+              wlandev->msdstate, ifstate);
+       switch (ifstate) {
        case P80211ENUM_ifstate_fwload:
                switch (wlandev->msdstate) {
                case WLAN_MSD_HWPRESENT:
@@ -504,12 +458,12 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
                         * Initialize the device+driver sufficiently
                         * for firmware loading.
                         */
-                       if ((result=hfa384x_drvr_start(hw))) {
-                               WLAN_LOG_ERROR(
-                                       "hfa384x_drvr_start() failed,"
-                                       "result=%d\n", (int)result);
+                       if ((result = hfa384x_drvr_start(hw))) {
+                               printk(KERN_ERR
+                                      "hfa384x_drvr_start() failed,"
+                                      "result=%d\n", (int)result);
                                result =
-                               P80211ENUM_resultcode_implementation_failure;
+                                   P80211ENUM_resultcode_implementation_failure;
                                wlandev->msdstate = WLAN_MSD_HWPRESENT;
                                break;
                        }
@@ -521,9 +475,9 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
                        result = P80211ENUM_resultcode_success;
                        break;
                case WLAN_MSD_RUNNING:
-                       WLAN_LOG_WARNING(
-                               "Cannot enter fwload state from enable state,"
-                               "you must disable first.\n");
+                       printk(KERN_WARNING
+                              "Cannot enter fwload state from enable state,"
+                              "you must disable first.\n");
                        result = P80211ENUM_resultcode_invalid_parameters;
                        break;
                case WLAN_MSD_HWFAIL:
@@ -548,32 +502,32 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
                         * can't make any assumptions about the state
                         * of the hardware or a previous firmware load.
                         */
-                       if ((result=hfa384x_drvr_start(hw))) {
-                               WLAN_LOG_ERROR(
-                                       "hfa384x_drvr_start() failed,"
-                                       "result=%d\n", (int)result);
+                       if ((result = hfa384x_drvr_start(hw))) {
+                               printk(KERN_ERR
+                                      "hfa384x_drvr_start() failed,"
+                                      "result=%d\n", (int)result);
                                result =
-                               P80211ENUM_resultcode_implementation_failure;
+                                   P80211ENUM_resultcode_implementation_failure;
                                wlandev->msdstate = WLAN_MSD_HWPRESENT;
                                break;
                        }
 
-                       if ((result=prism2sta_getcardinfo(wlandev))) {
-                               WLAN_LOG_ERROR(
-                                       "prism2sta_getcardinfo() failed,"
-                                       "result=%d\n", (int)result);
+                       if ((result = prism2sta_getcardinfo(wlandev))) {
+                               printk(KERN_ERR
+                                      "prism2sta_getcardinfo() failed,"
+                                      "result=%d\n", (int)result);
                                result =
-                               P80211ENUM_resultcode_implementation_failure;
+                                   P80211ENUM_resultcode_implementation_failure;
                                hfa384x_drvr_stop(hw);
                                wlandev->msdstate = WLAN_MSD_HWPRESENT;
                                break;
                        }
-                       if ((result=prism2sta_globalsetup(wlandev))) {
-                               WLAN_LOG_ERROR(
-                                       "prism2sta_globalsetup() failed,"
-                                       "result=%d\n", (int)result);
+                       if ((result = prism2sta_globalsetup(wlandev))) {
+                               printk(KERN_ERR
+                                      "prism2sta_globalsetup() failed,"
+                                      "result=%d\n", (int)result);
                                result =
-                               P80211ENUM_resultcode_implementation_failure;
+                                   P80211ENUM_resultcode_implementation_failure;
                                hfa384x_drvr_stop(hw);
                                wlandev->msdstate = WLAN_MSD_HWPRESENT;
                                break;
@@ -584,7 +538,7 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
                        result = P80211ENUM_resultcode_success;
                        break;
                case WLAN_MSD_RUNNING:
-                       /* Do nothing, we're already in this state.*/
+                       /* Do nothing, we're already in this state. */
                        result = P80211ENUM_resultcode_success;
                        break;
                case WLAN_MSD_HWFAIL:
@@ -599,7 +553,7 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
        case P80211ENUM_ifstate_disable:
                switch (wlandev->msdstate) {
                case WLAN_MSD_HWPRESENT:
-                       /* Do nothing, we're already in this state.*/
+                       /* Do nothing, we're already in this state. */
                        result = P80211ENUM_resultcode_success;
                        break;
                case WLAN_MSD_FWLOAD:
@@ -634,11 +588,9 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
                break;
        }
 
-       DBFEXIT;
        return result;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_getcardinfo
 *
@@ -660,269 +612,284 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
 ----------------------------------------------------------------*/
 static int prism2sta_getcardinfo(wlandevice_t *wlandev)
 {
-       int                     result = 0;
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       u16                  temp;
-       u8                      snum[HFA384x_RID_NICSERIALNUMBER_LEN];
-       char                    pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1];
-
-       DBFENTER;
+       int result = 0;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       u16 temp;
+       u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN];
+       char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1];
 
        /* Collect version and compatibility info */
        /*  Some are critical, some are not */
        /* NIC identity */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY,
-                       &hw->ident_nic, sizeof(hfa384x_compident_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve NICIDENTITY\n");
+                                       &hw->ident_nic,
+                                       sizeof(hfa384x_compident_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve NICIDENTITY\n");
                goto failed;
        }
 
        /* get all the nic id fields in host byte order */
-       hw->ident_nic.id = hfa384x2host_16(hw->ident_nic.id);
-       hw->ident_nic.variant = hfa384x2host_16(hw->ident_nic.variant);
-       hw->ident_nic.major = hfa384x2host_16(hw->ident_nic.major);
-       hw->ident_nic.minor = hfa384x2host_16(hw->ident_nic.minor);
+       hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id);
+       hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant);
+       hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major);
+       hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor);
 
-       WLAN_LOG_INFO( "ident: nic h/w: id=0x%02x %d.%d.%d\n",
-                       hw->ident_nic.id, hw->ident_nic.major,
-                       hw->ident_nic.minor, hw->ident_nic.variant);
+       printk(KERN_INFO "ident: nic h/w: id=0x%02x %d.%d.%d\n",
+              hw->ident_nic.id, hw->ident_nic.major,
+              hw->ident_nic.minor, hw->ident_nic.variant);
 
        /* Primary f/w identity */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY,
-                       &hw->ident_pri_fw, sizeof(hfa384x_compident_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve PRIIDENTITY\n");
+                                       &hw->ident_pri_fw,
+                                       sizeof(hfa384x_compident_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve PRIIDENTITY\n");
                goto failed;
        }
 
        /* get all the private fw id fields in host byte order */
-       hw->ident_pri_fw.id = hfa384x2host_16(hw->ident_pri_fw.id);
-       hw->ident_pri_fw.variant = hfa384x2host_16(hw->ident_pri_fw.variant);
-       hw->ident_pri_fw.major = hfa384x2host_16(hw->ident_pri_fw.major);
-       hw->ident_pri_fw.minor = hfa384x2host_16(hw->ident_pri_fw.minor);
+       hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id);
+       hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant);
+       hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major);
+       hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor);
 
-       WLAN_LOG_INFO( "ident: pri f/w: id=0x%02x %d.%d.%d\n",
-                       hw->ident_pri_fw.id, hw->ident_pri_fw.major,
-                       hw->ident_pri_fw.minor, hw->ident_pri_fw.variant);
+       printk(KERN_INFO "ident: pri f/w: id=0x%02x %d.%d.%d\n",
+              hw->ident_pri_fw.id, hw->ident_pri_fw.major,
+              hw->ident_pri_fw.minor, hw->ident_pri_fw.variant);
 
        /* Station (Secondary?) f/w identity */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY,
-                       &hw->ident_sta_fw, sizeof(hfa384x_compident_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve STAIDENTITY\n");
+                                       &hw->ident_sta_fw,
+                                       sizeof(hfa384x_compident_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve STAIDENTITY\n");
                goto failed;
        }
 
        if (hw->ident_nic.id < 0x8000) {
-               WLAN_LOG_ERROR("FATAL: Card is not an Intersil Prism2/2.5/3\n");
+               printk(KERN_ERR
+                      "FATAL: Card is not an Intersil Prism2/2.5/3\n");
                result = -1;
                goto failed;
        }
 
        /* get all the station fw id fields in host byte order */
-       hw->ident_sta_fw.id = hfa384x2host_16(hw->ident_sta_fw.id);
-       hw->ident_sta_fw.variant = hfa384x2host_16(hw->ident_sta_fw.variant);
-       hw->ident_sta_fw.major = hfa384x2host_16(hw->ident_sta_fw.major);
-       hw->ident_sta_fw.minor = hfa384x2host_16(hw->ident_sta_fw.minor);
+       hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id);
+       hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant);
+       hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major);
+       hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
 
        /* strip out the 'special' variant bits */
-       hw->mm_mods = hw->ident_sta_fw.variant & (BIT14 | BIT15);
-       hw->ident_sta_fw.variant &= ~((u16)(BIT14 | BIT15));
-
-       if  ( hw->ident_sta_fw.id == 0x1f ) {
-               WLAN_LOG_INFO(
-                       "ident: sta f/w: id=0x%02x %d.%d.%d\n",
-                       hw->ident_sta_fw.id, hw->ident_sta_fw.major,
-                       hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
+       hw->mm_mods = hw->ident_sta_fw.variant & (BIT(14) | BIT(15));
+       hw->ident_sta_fw.variant &= ~((u16) (BIT(14) | BIT(15)));
+
+       if (hw->ident_sta_fw.id == 0x1f) {
+               printk(KERN_INFO
+                      "ident: sta f/w: id=0x%02x %d.%d.%d\n",
+                      hw->ident_sta_fw.id, hw->ident_sta_fw.major,
+                      hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
        } else {
-               WLAN_LOG_INFO(
-                       "ident:  ap f/w: id=0x%02x %d.%d.%d\n",
-                       hw->ident_sta_fw.id, hw->ident_sta_fw.major,
-                       hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
-               WLAN_LOG_ERROR("Unsupported Tertiary AP firmeare loaded!\n");
+               printk(KERN_INFO
+                      "ident:  ap f/w: id=0x%02x %d.%d.%d\n",
+                      hw->ident_sta_fw.id, hw->ident_sta_fw.major,
+                      hw->ident_sta_fw.minor, hw->ident_sta_fw.variant);
+               printk(KERN_ERR "Unsupported Tertiary AP firmeare loaded!\n");
                goto failed;
        }
 
        /* Compatibility range, Modem supplier */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE,
-                       &hw->cap_sup_mfi, sizeof(hfa384x_caplevel_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve MFISUPRANGE\n");
+                                       &hw->cap_sup_mfi,
+                                       sizeof(hfa384x_caplevel_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve MFISUPRANGE\n");
                goto failed;
        }
 
        /* get all the Compatibility range, modem interface supplier
-       fields in byte order */
-       hw->cap_sup_mfi.role = hfa384x2host_16(hw->cap_sup_mfi.role);
-       hw->cap_sup_mfi.id = hfa384x2host_16(hw->cap_sup_mfi.id);
-       hw->cap_sup_mfi.variant = hfa384x2host_16(hw->cap_sup_mfi.variant);
-       hw->cap_sup_mfi.bottom = hfa384x2host_16(hw->cap_sup_mfi.bottom);
-       hw->cap_sup_mfi.top = hfa384x2host_16(hw->cap_sup_mfi.top);
-
-       WLAN_LOG_INFO(
-               "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
-               hw->cap_sup_mfi.role, hw->cap_sup_mfi.id,
-               hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom,
-               hw->cap_sup_mfi.top);
+          fields in byte order */
+       hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role);
+       hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id);
+       hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant);
+       hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom);
+       hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top);
+
+       printk(KERN_INFO
+              "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
+              hw->cap_sup_mfi.role, hw->cap_sup_mfi.id,
+              hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom,
+              hw->cap_sup_mfi.top);
 
        /* Compatibility range, Controller supplier */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE,
-                       &hw->cap_sup_cfi, sizeof(hfa384x_caplevel_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve CFISUPRANGE\n");
+                                       &hw->cap_sup_cfi,
+                                       sizeof(hfa384x_caplevel_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve CFISUPRANGE\n");
                goto failed;
        }
 
        /* get all the Compatibility range, controller interface supplier
-       fields in byte order */
-       hw->cap_sup_cfi.role = hfa384x2host_16(hw->cap_sup_cfi.role);
-       hw->cap_sup_cfi.id = hfa384x2host_16(hw->cap_sup_cfi.id);
-       hw->cap_sup_cfi.variant = hfa384x2host_16(hw->cap_sup_cfi.variant);
-       hw->cap_sup_cfi.bottom = hfa384x2host_16(hw->cap_sup_cfi.bottom);
-       hw->cap_sup_cfi.top = hfa384x2host_16(hw->cap_sup_cfi.top);
-
-       WLAN_LOG_INFO(
-               "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
-               hw->cap_sup_cfi.role, hw->cap_sup_cfi.id,
-               hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom,
-               hw->cap_sup_cfi.top);
+          fields in byte order */
+       hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role);
+       hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id);
+       hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant);
+       hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom);
+       hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top);
+
+       printk(KERN_INFO
+              "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
+              hw->cap_sup_cfi.role, hw->cap_sup_cfi.id,
+              hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom,
+              hw->cap_sup_cfi.top);
 
        /* Compatibility range, Primary f/w supplier */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE,
-                       &hw->cap_sup_pri, sizeof(hfa384x_caplevel_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve PRISUPRANGE\n");
+                                       &hw->cap_sup_pri,
+                                       sizeof(hfa384x_caplevel_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve PRISUPRANGE\n");
                goto failed;
        }
 
        /* get all the Compatibility range, primary firmware supplier
-       fields in byte order */
-       hw->cap_sup_pri.role = hfa384x2host_16(hw->cap_sup_pri.role);
-       hw->cap_sup_pri.id = hfa384x2host_16(hw->cap_sup_pri.id);
-       hw->cap_sup_pri.variant = hfa384x2host_16(hw->cap_sup_pri.variant);
-       hw->cap_sup_pri.bottom = hfa384x2host_16(hw->cap_sup_pri.bottom);
-       hw->cap_sup_pri.top = hfa384x2host_16(hw->cap_sup_pri.top);
-
-       WLAN_LOG_INFO(
-               "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
-               hw->cap_sup_pri.role, hw->cap_sup_pri.id,
-               hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom,
-               hw->cap_sup_pri.top);
+          fields in byte order */
+       hw->cap_sup_pri.role = le16_to_cpu(hw->cap_sup_pri.role);
+       hw->cap_sup_pri.id = le16_to_cpu(hw->cap_sup_pri.id);
+       hw->cap_sup_pri.variant = le16_to_cpu(hw->cap_sup_pri.variant);
+       hw->cap_sup_pri.bottom = le16_to_cpu(hw->cap_sup_pri.bottom);
+       hw->cap_sup_pri.top = le16_to_cpu(hw->cap_sup_pri.top);
+
+       printk(KERN_INFO
+              "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
+              hw->cap_sup_pri.role, hw->cap_sup_pri.id,
+              hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom,
+              hw->cap_sup_pri.top);
 
        /* Compatibility range, Station f/w supplier */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE,
-                       &hw->cap_sup_sta, sizeof(hfa384x_caplevel_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve STASUPRANGE\n");
+                                       &hw->cap_sup_sta,
+                                       sizeof(hfa384x_caplevel_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve STASUPRANGE\n");
                goto failed;
        }
 
        /* get all the Compatibility range, station firmware supplier
-       fields in byte order */
-       hw->cap_sup_sta.role = hfa384x2host_16(hw->cap_sup_sta.role);
-       hw->cap_sup_sta.id = hfa384x2host_16(hw->cap_sup_sta.id);
-       hw->cap_sup_sta.variant = hfa384x2host_16(hw->cap_sup_sta.variant);
-       hw->cap_sup_sta.bottom = hfa384x2host_16(hw->cap_sup_sta.bottom);
-       hw->cap_sup_sta.top = hfa384x2host_16(hw->cap_sup_sta.top);
-
-       if ( hw->cap_sup_sta.id == 0x04 ) {
-               WLAN_LOG_INFO(
-               "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
-               hw->cap_sup_sta.role, hw->cap_sup_sta.id,
-               hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
-               hw->cap_sup_sta.top);
+          fields in byte order */
+       hw->cap_sup_sta.role = le16_to_cpu(hw->cap_sup_sta.role);
+       hw->cap_sup_sta.id = le16_to_cpu(hw->cap_sup_sta.id);
+       hw->cap_sup_sta.variant = le16_to_cpu(hw->cap_sup_sta.variant);
+       hw->cap_sup_sta.bottom = le16_to_cpu(hw->cap_sup_sta.bottom);
+       hw->cap_sup_sta.top = le16_to_cpu(hw->cap_sup_sta.top);
+
+       if (hw->cap_sup_sta.id == 0x04) {
+               printk(KERN_INFO
+                      "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
+                      hw->cap_sup_sta.role, hw->cap_sup_sta.id,
+                      hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
+                      hw->cap_sup_sta.top);
        } else {
-               WLAN_LOG_INFO(
-               "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
-               hw->cap_sup_sta.role, hw->cap_sup_sta.id,
-               hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
-               hw->cap_sup_sta.top);
+               printk(KERN_INFO
+                      "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
+                      hw->cap_sup_sta.role, hw->cap_sup_sta.id,
+                      hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom,
+                      hw->cap_sup_sta.top);
        }
 
        /* Compatibility range, primary f/w actor, CFI supplier */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES,
-                       &hw->cap_act_pri_cfi, sizeof(hfa384x_caplevel_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve PRI_CFIACTRANGES\n");
+                                       &hw->cap_act_pri_cfi,
+                                       sizeof(hfa384x_caplevel_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve PRI_CFIACTRANGES\n");
                goto failed;
        }
 
        /* get all the Compatibility range, primary f/w actor, CFI supplier
-       fields in byte order */
-       hw->cap_act_pri_cfi.role = hfa384x2host_16(hw->cap_act_pri_cfi.role);
-       hw->cap_act_pri_cfi.id = hfa384x2host_16(hw->cap_act_pri_cfi.id);
-       hw->cap_act_pri_cfi.variant = hfa384x2host_16(hw->cap_act_pri_cfi.variant);
-       hw->cap_act_pri_cfi.bottom = hfa384x2host_16(hw->cap_act_pri_cfi.bottom);
-       hw->cap_act_pri_cfi.top = hfa384x2host_16(hw->cap_act_pri_cfi.top);
-
-       WLAN_LOG_INFO(
-               "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
-               hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id,
-               hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom,
-               hw->cap_act_pri_cfi.top);
+          fields in byte order */
+       hw->cap_act_pri_cfi.role = le16_to_cpu(hw->cap_act_pri_cfi.role);
+       hw->cap_act_pri_cfi.id = le16_to_cpu(hw->cap_act_pri_cfi.id);
+       hw->cap_act_pri_cfi.variant =
+           le16_to_cpu(hw->cap_act_pri_cfi.variant);
+       hw->cap_act_pri_cfi.bottom =
+           le16_to_cpu(hw->cap_act_pri_cfi.bottom);
+       hw->cap_act_pri_cfi.top = le16_to_cpu(hw->cap_act_pri_cfi.top);
+
+       printk(KERN_INFO
+              "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
+              hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id,
+              hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom,
+              hw->cap_act_pri_cfi.top);
 
        /* Compatibility range, sta f/w actor, CFI supplier */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES,
-                       &hw->cap_act_sta_cfi, sizeof(hfa384x_caplevel_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve STA_CFIACTRANGES\n");
+                                       &hw->cap_act_sta_cfi,
+                                       sizeof(hfa384x_caplevel_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve STA_CFIACTRANGES\n");
                goto failed;
        }
 
        /* get all the Compatibility range, station f/w actor, CFI supplier
-       fields in byte order */
-       hw->cap_act_sta_cfi.role = hfa384x2host_16(hw->cap_act_sta_cfi.role);
-       hw->cap_act_sta_cfi.id = hfa384x2host_16(hw->cap_act_sta_cfi.id);
-       hw->cap_act_sta_cfi.variant = hfa384x2host_16(hw->cap_act_sta_cfi.variant);
-       hw->cap_act_sta_cfi.bottom = hfa384x2host_16(hw->cap_act_sta_cfi.bottom);
-       hw->cap_act_sta_cfi.top = hfa384x2host_16(hw->cap_act_sta_cfi.top);
-
-       WLAN_LOG_INFO(
-               "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
-               hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id,
-               hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom,
-               hw->cap_act_sta_cfi.top);
+          fields in byte order */
+       hw->cap_act_sta_cfi.role = le16_to_cpu(hw->cap_act_sta_cfi.role);
+       hw->cap_act_sta_cfi.id = le16_to_cpu(hw->cap_act_sta_cfi.id);
+       hw->cap_act_sta_cfi.variant =
+           le16_to_cpu(hw->cap_act_sta_cfi.variant);
+       hw->cap_act_sta_cfi.bottom =
+           le16_to_cpu(hw->cap_act_sta_cfi.bottom);
+       hw->cap_act_sta_cfi.top = le16_to_cpu(hw->cap_act_sta_cfi.top);
+
+       printk(KERN_INFO
+              "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
+              hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id,
+              hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom,
+              hw->cap_act_sta_cfi.top);
 
        /* Compatibility range, sta f/w actor, MFI supplier */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES,
-                       &hw->cap_act_sta_mfi, sizeof(hfa384x_caplevel_t));
-       if ( result ) {
-               WLAN_LOG_ERROR("Failed to retrieve STA_MFIACTRANGES\n");
+                                       &hw->cap_act_sta_mfi,
+                                       sizeof(hfa384x_caplevel_t));
+       if (result) {
+               printk(KERN_ERR "Failed to retrieve STA_MFIACTRANGES\n");
                goto failed;
        }
 
        /* get all the Compatibility range, station f/w actor, MFI supplier
-       fields in byte order */
-       hw->cap_act_sta_mfi.role = hfa384x2host_16(hw->cap_act_sta_mfi.role);
-       hw->cap_act_sta_mfi.id = hfa384x2host_16(hw->cap_act_sta_mfi.id);
-       hw->cap_act_sta_mfi.variant = hfa384x2host_16(hw->cap_act_sta_mfi.variant);
-       hw->cap_act_sta_mfi.bottom = hfa384x2host_16(hw->cap_act_sta_mfi.bottom);
-       hw->cap_act_sta_mfi.top = hfa384x2host_16(hw->cap_act_sta_mfi.top);
-
-       WLAN_LOG_INFO(
-               "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
-               hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id,
-               hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom,
-               hw->cap_act_sta_mfi.top);
+          fields in byte order */
+       hw->cap_act_sta_mfi.role = le16_to_cpu(hw->cap_act_sta_mfi.role);
+       hw->cap_act_sta_mfi.id = le16_to_cpu(hw->cap_act_sta_mfi.id);
+       hw->cap_act_sta_mfi.variant =
+           le16_to_cpu(hw->cap_act_sta_mfi.variant);
+       hw->cap_act_sta_mfi.bottom =
+           le16_to_cpu(hw->cap_act_sta_mfi.bottom);
+       hw->cap_act_sta_mfi.top = le16_to_cpu(hw->cap_act_sta_mfi.top);
+
+       printk(KERN_INFO
+              "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n",
+              hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id,
+              hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom,
+              hw->cap_act_sta_mfi.top);
 
        /* Serial Number */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER,
-                       snum, HFA384x_RID_NICSERIALNUMBER_LEN);
-       if ( !result ) {
+                                       snum, HFA384x_RID_NICSERIALNUMBER_LEN);
+       if (!result) {
                wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN,
                                pstr, sizeof(pstr));
-               WLAN_LOG_INFO("Prism2 card SN: %s\n", pstr);
+               printk(KERN_INFO "Prism2 card SN: %s\n", pstr);
        } else {
-               WLAN_LOG_ERROR("Failed to retrieve Prism2 Card SN\n");
+               printk(KERN_ERR "Failed to retrieve Prism2 Card SN\n");
                goto failed;
        }
 
        /* Collect the MAC address */
        result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR,
-               wlandev->netdev->dev_addr, WLAN_ADDR_LEN);
-       if ( result != 0 ) {
-               WLAN_LOG_ERROR("Failed to retrieve mac address\n");
+                                       wlandev->netdev->dev_addr, ETH_ALEN);
+       if (result != 0) {
+               printk(KERN_ERR "Failed to retrieve mac address\n");
                goto failed;
        }
 
@@ -939,10 +906,10 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
        hw->dbmadjust = temp;
 
        /* Only enable scan by default on newer firmware */
-        if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major,
-                                     hw->ident_sta_fw.minor,
-                                     hw->ident_sta_fw.variant) <
-           HFA384x_FIRMWARE_VERSION(1,5,5)) {
+       if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major,
+                                    hw->ident_sta_fw.minor,
+                                    hw->ident_sta_fw.variant) <
+           HFA384x_FIRMWARE_VERSION(1, 5, 5)) {
                wlandev->nsdcaps |= P80211_NSDCAP_NOSCAN;
        }
 
@@ -950,13 +917,11 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
 
        goto done;
 failed:
-       WLAN_LOG_ERROR("Failed, result=%d\n", result);
+       printk(KERN_ERR "Failed, result=%d\n", result);
 done:
-       DBFEXIT;
        return result;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_globalsetup
 *
@@ -977,43 +942,33 @@ done:
 ----------------------------------------------------------------*/
 static int prism2sta_globalsetup(wlandevice_t *wlandev)
 {
-       hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
 
        /* Set the maximum frame size */
        return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN,
-                                           WLAN_DATA_MAXLEN);
+                                       WLAN_DATA_MAXLEN);
 }
 
 static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev)
 {
        int result = 0;
-       hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
 
-       u16  promisc;
-
-       DBFENTER;
+       u16 promisc;
 
        /* If we're not ready, what's the point? */
-       if ( hw->state != HFA384x_STATE_RUNNING )
+       if (hw->state != HFA384x_STATE_RUNNING)
                goto exit;
 
-       if ( (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0 )
+       if ((dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
                promisc = P80211ENUM_truth_true;
        else
                promisc = P80211ENUM_truth_false;
 
-       result = hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE, promisc);
-
-       /* XXX TODO: configure the multicast list */
-       // CLEAR_HW_MULTICAST_LIST
-       // struct dev_mc_list element = dev->mc_list;
-       // while (element != null) {
-       //  HW_ADD_MULTICAST_ADDR(element->dmi_addr, dmi_addrlen)
-       //  element = element->next;
-       // }
-
- exit:
-       DBFEXIT;
+       result =
+           hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE,
+                                          promisc);
+exit:
        return result;
 }
 
@@ -1035,15 +990,13 @@ static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev)
 * Call context:
 *      interrupt
 ----------------------------------------------------------------*/
-static void prism2sta_inf_handover(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
+static void prism2sta_inf_handover(wlandevice_t *wlandev,
+                                  hfa384x_InfFrame_t *inf)
 {
-       DBFENTER;
-       WLAN_LOG_DEBUG(2,"received infoframe:HANDOVER (unhandled)\n");
-       DBFEXIT;
+       pr_debug("received infoframe:HANDOVER (unhandled)\n");
        return;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_inf_tallies
 *
@@ -1061,37 +1014,34 @@ static void prism2sta_inf_handover(wlandevice_t *wlandev, hfa384x_InfFrame_t *in
 * Call context:
 *      interrupt
 ----------------------------------------------------------------*/
-static void prism2sta_inf_tallies(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
+static void prism2sta_inf_tallies(wlandevice_t *wlandev,
+                                 hfa384x_InfFrame_t *inf)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       u16                     *src16;
-       u32                     *dst;
-       u32                     *src32;
-       int                     i;
-       int                     cnt;
-
-       DBFENTER;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       u16 *src16;
+       u32 *dst;
+       u32 *src32;
+       int i;
+       int cnt;
 
        /*
-       ** Determine if these are 16-bit or 32-bit tallies, based on the
-       ** record length of the info record.
-       */
+        ** Determine if these are 16-bit or 32-bit tallies, based on the
+        ** record length of the info record.
+        */
 
        cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(u32);
        if (inf->framelen > 22) {
-               dst   = (u32 *) &hw->tallies;
-               src32 = (u32 *) &inf->info.commtallies32;
+               dst = (u32 *)&hw->tallies;
+               src32 = (u32 *)&inf->info.commtallies32;
                for (i = 0; i < cnt; i++, dst++, src32++)
-                       *dst += hfa384x2host_32(*src32);
+                       *dst += le32_to_cpu(*src32);
        } else {
-               dst   = (u32 *) &hw->tallies;
-               src16 = (u16 *) &inf->info.commtallies16;
+               dst = (u32 *)&hw->tallies;
+               src16 = (u16 *)&inf->info.commtallies16;
                for (i = 0; i < cnt; i++, dst++, src16++)
-                       *dst += hfa384x2host_16(*src16);
+                       *dst += le16_to_cpu(*src16);
        }
 
-       DBFEXIT;
-
        return;
 }
 
@@ -1116,44 +1066,40 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
                                      hfa384x_InfFrame_t *inf)
 {
 
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       int                     nbss;
-       hfa384x_ScanResult_t    *sr = &(inf->info.scanresult);
-       int                     i;
-       hfa384x_JoinRequest_data_t      joinreq;
-       int                     result;
-       DBFENTER;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       int nbss;
+       hfa384x_ScanResult_t *sr = &(inf->info.scanresult);
+       int i;
+       hfa384x_JoinRequest_data_t joinreq;
+       int result;
 
        /* Get the number of results, first in bytes, then in results */
        nbss = (inf->framelen * sizeof(u16)) -
-               sizeof(inf->infotype) -
-               sizeof(inf->info.scanresult.scanreason);
+           sizeof(inf->infotype) - sizeof(inf->info.scanresult.scanreason);
        nbss /= sizeof(hfa384x_ScanResultSub_t);
 
        /* Print em */
-       WLAN_LOG_DEBUG(1,"rx scanresults, reason=%d, nbss=%d:\n",
-               inf->info.scanresult.scanreason, nbss);
-       for ( i = 0; i < nbss; i++) {
-               WLAN_LOG_DEBUG(1, "chid=%d anl=%d sl=%d bcnint=%d\n",
-                       sr->result[i].chid,
-                       sr->result[i].anl,
-                       sr->result[i].sl,
-                       sr->result[i].bcnint);
-               WLAN_LOG_DEBUG(1, "  capinfo=0x%04x proberesp_rate=%d\n",
-                       sr->result[i].capinfo,
-                       sr->result[i].proberesp_rate);
+       pr_debug("rx scanresults, reason=%d, nbss=%d:\n",
+              inf->info.scanresult.scanreason, nbss);
+       for (i = 0; i < nbss; i++) {
+               pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n",
+                      sr->result[i].chid,
+                      sr->result[i].anl,
+                      sr->result[i].sl, sr->result[i].bcnint);
+               pr_debug("  capinfo=0x%04x proberesp_rate=%d\n",
+                      sr->result[i].capinfo, sr->result[i].proberesp_rate);
        }
        /* issue a join request */
        joinreq.channel = sr->result[0].chid;
-       memcpy( joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN);
-       result = hfa384x_drvr_setconfig( hw,
-                       HFA384x_RID_JOINREQUEST,
-                       &joinreq, HFA384x_RID_JOINREQUEST_LEN);
+       memcpy(joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN);
+       result = hfa384x_drvr_setconfig(hw,
+                                       HFA384x_RID_JOINREQUEST,
+                                       &joinreq, HFA384x_RID_JOINREQUEST_LEN);
        if (result) {
-               WLAN_LOG_ERROR("setconfig(joinreq) failed, result=%d\n", result);
+               printk(KERN_ERR "setconfig(joinreq) failed, result=%d\n",
+                      result);
        }
 
-       DBFEXIT;
        return;
 }
 
@@ -1177,18 +1123,16 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
 static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
                                          hfa384x_InfFrame_t *inf)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       int                     nbss;
-       DBFENTER;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       int nbss;
 
        nbss = (inf->framelen - 3) / 32;
-       WLAN_LOG_DEBUG(1, "Received %d hostscan results\n", nbss);
+       pr_debug("Received %d hostscan results\n", nbss);
 
        if (nbss > 32)
                nbss = 32;
 
-       if (hw->scanresults)
-               kfree(hw->scanresults);
+       kfree(hw->scanresults);
 
        hw->scanresults = kmalloc(sizeof(hfa384x_InfFrame_t), GFP_ATOMIC);
        memcpy(hw->scanresults, inf, sizeof(hfa384x_InfFrame_t));
@@ -1196,11 +1140,9 @@ static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
        if (nbss == 0)
                nbss = -1;
 
-        /* Notify/wake the sleeping caller. */
-        hw->scanflag = nbss;
-        wake_up_interruptible(&hw->cmdq);
-
-       DBFEXIT;
+       /* Notify/wake the sleeping caller. */
+       hw->scanflag = nbss;
+       wake_up_interruptible(&hw->cmdq);
 };
 
 /*----------------------------------------------------------------
@@ -1223,55 +1165,60 @@ static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
 static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
                                        hfa384x_InfFrame_t *inf)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       unsigned int            i, n;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       unsigned int i, n;
 
-       DBFENTER;
        hw->channel_info.results.scanchannels =
-               hfa384x2host_16(inf->info.chinforesult.scanchannels);
-#if 0
-       memcpy(&inf->info.chinforesult, &hw->channel_info.results, sizeof(hfa384x_ChInfoResult_t));
-#endif
-
-       for (i=0, n=0; i<HFA384x_CHINFORESULT_MAX; i++) {
-               if (hw->channel_info.results.scanchannels & (1<<i)) {
-                       int     channel=hfa384x2host_16(inf->info.chinforesult.result[n].chid)-1;
-                       hfa384x_ChInfoResultSub_t *chinforesult=&hw->channel_info.results.result[channel];
-                       chinforesult->chid   = channel;
-                       chinforesult->anl    = hfa384x2host_16(inf->info.chinforesult.result[n].anl);
-                       chinforesult->pnl    = hfa384x2host_16(inf->info.chinforesult.result[n].pnl);
-                       chinforesult->active = hfa384x2host_16(inf->info.chinforesult.result[n].active);
-                       WLAN_LOG_DEBUG(2, "chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
-                                       channel+1,
-                                       chinforesult->active &
-                                       HFA384x_CHINFORESULT_BSSACTIVE ? "signal" : "noise",
-                                       chinforesult->anl, chinforesult->pnl,
-                                       chinforesult->active & HFA384x_CHINFORESULT_PCFACTIVE ? 1 : 0
-                       );
+           le16_to_cpu(inf->info.chinforesult.scanchannels);
+
+       for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) {
+               if (hw->channel_info.results.scanchannels & (1 << i)) {
+                       int channel =
+                           le16_to_cpu(inf->info.chinforesult.result[n].
+                                           chid) - 1;
+                       hfa384x_ChInfoResultSub_t *chinforesult =
+                           &hw->channel_info.results.result[channel];
+                       chinforesult->chid = channel;
+                       chinforesult->anl =
+                           le16_to_cpu(inf->info.chinforesult.result[n].
+                                           anl);
+                       chinforesult->pnl =
+                           le16_to_cpu(inf->info.chinforesult.result[n].
+                                           pnl);
+                       chinforesult->active =
+                           le16_to_cpu(inf->info.chinforesult.result[n].
+                                           active);
+                       printk(KERN_DEBUG
+                              "chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
+                              channel + 1,
+                              chinforesult->
+                              active & HFA384x_CHINFORESULT_BSSACTIVE ?
+                              "signal" : "noise", chinforesult->anl,
+                              chinforesult->pnl,
+                              chinforesult->
+                              active & HFA384x_CHINFORESULT_PCFACTIVE ? 1 : 0);
                        n++;
                }
        }
        atomic_set(&hw->channel_info.done, 2);
 
        hw->channel_info.count = n;
-       DBFEXIT;
        return;
 }
 
 void prism2sta_processing_defer(struct work_struct *data)
 {
-       hfa384x_t               *hw = container_of(data, struct hfa384x, link_bh);
-       wlandevice_t            *wlandev = hw->wlandev;
+       hfa384x_t *hw = container_of(data, struct hfa384x, link_bh);
+       wlandevice_t *wlandev = hw->wlandev;
        hfa384x_bytestr32_t ssid;
-       int                     result;
+       int result;
 
-       DBFENTER;
        /* First let's process the auth frames */
        {
-               struct sk_buff          *skb;
+               struct sk_buff *skb;
                hfa384x_InfFrame_t *inf;
 
-               while ( (skb = skb_dequeue(&hw->authq)) ) {
+               while ((skb = skb_dequeue(&hw->authq))) {
                        inf = (hfa384x_InfFrame_t *) skb->data;
                        prism2sta_inf_authreq_defer(wlandev, inf);
                }
@@ -1284,7 +1231,7 @@ void prism2sta_processing_defer(struct work_struct *data)
 
        hw->link_status = hw->link_status_new;
 
-       switch(hw->link_status) {
+       switch (hw->link_status) {
        case HFA384x_LINK_NOTCONNECTED:
                /* I'm currently assuming that this is the initial link
                 * state.  It should only be possible immediately
@@ -1294,7 +1241,7 @@ void prism2sta_processing_defer(struct work_struct *data)
                 */
                netif_carrier_off(wlandev->netdev);
 
-               WLAN_LOG_INFO("linkstatus=NOTCONNECTED (unhandled)\n");
+               printk(KERN_INFO "linkstatus=NOTCONNECTED (unhandled)\n");
                break;
 
        case HFA384x_LINK_CONNECTED:
@@ -1311,53 +1258,56 @@ void prism2sta_processing_defer(struct work_struct *data)
                netif_carrier_on(wlandev->netdev);
 
                /* If we are joining a specific AP, set our state and reset retries */
-               if(hw->join_ap == 1)
+               if (hw->join_ap == 1)
                        hw->join_ap = 2;
                hw->join_retries = 60;
 
                /* Don't call this in monitor mode */
-               if ( wlandev->netdev->type == ARPHRD_ETHER ) {
-                       u16                     portstatus;
+               if (wlandev->netdev->type == ARPHRD_ETHER) {
+                       u16 portstatus;
 
-                       WLAN_LOG_INFO("linkstatus=CONNECTED\n");
+                       printk(KERN_INFO "linkstatus=CONNECTED\n");
 
                        /* For non-usb devices, we can use the sync versions */
                        /* Collect the BSSID, and set state to allow tx */
 
                        result = hfa384x_drvr_getconfig(hw,
                                                        HFA384x_RID_CURRENTBSSID,
-                                                       wlandev->bssid, WLAN_BSSID_LEN);
-                       if ( result ) {
-                               WLAN_LOG_DEBUG(1,
-                                              "getconfig(0x%02x) failed, result = %d\n",
-                                              HFA384x_RID_CURRENTBSSID, result);
+                                                       wlandev->bssid,
+                                                       WLAN_BSSID_LEN);
+                       if (result) {
+                               printk(KERN_DEBUG
+                                      "getconfig(0x%02x) failed, result = %d\n",
+                                      HFA384x_RID_CURRENTBSSID, result);
                                goto failed;
                        }
 
                        result = hfa384x_drvr_getconfig(hw,
                                                        HFA384x_RID_CURRENTSSID,
                                                        &ssid, sizeof(ssid));
-                       if ( result ) {
-                               WLAN_LOG_DEBUG(1,
-                                              "getconfig(0x%02x) failed, result = %d\n",
-                                              HFA384x_RID_CURRENTSSID, result);
+                       if (result) {
+                               printk(KERN_DEBUG
+                                      "getconfig(0x%02x) failed, result = %d\n",
+                                      HFA384x_RID_CURRENTSSID, result);
                                goto failed;
                        }
                        prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid,
-                                               (p80211pstrd_t *) &wlandev->ssid);
+                                               (p80211pstrd_t *)&wlandev->
+                                               ssid);
 
                        /* Collect the port status */
                        result = hfa384x_drvr_getconfig16(hw,
-                                                         HFA384x_RID_PORTSTATUS, &portstatus);
-                       if ( result ) {
-                               WLAN_LOG_DEBUG(1,
-                                              "getconfig(0x%02x) failed, result = %d\n",
-                                              HFA384x_RID_PORTSTATUS, result);
+                                                         HFA384x_RID_PORTSTATUS,
+                                                         &portstatus);
+                       if (result) {
+                               printk(KERN_DEBUG
+                                      "getconfig(0x%02x) failed, result = %d\n",
+                                      HFA384x_RID_PORTSTATUS, result);
                                goto failed;
                        }
                        wlandev->macmode =
-                               (portstatus == HFA384x_PSTATUS_CONN_IBSS) ?
-                               WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA;
+                           (portstatus == HFA384x_PSTATUS_CONN_IBSS) ?
+                           WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA;
 
                        /* Get the ball rolling on the comms quality stuff */
                        prism2sta_commsqual_defer(&hw->commsqual_bh);
@@ -1374,18 +1324,20 @@ void prism2sta_processing_defer(struct work_struct *data)
                 * Indicate Deauthentication
                 * Block Transmits, Ignore receives of data frames
                 */
-               if(hw->join_ap == 2)
-               {
-                       hfa384x_JoinRequest_data_t      joinreq;
+               if (hw->join_ap == 2) {
+                       hfa384x_JoinRequest_data_t joinreq;
                        joinreq = hw->joinreq;
                        /* Send the join request */
-                       hfa384x_drvr_setconfig( hw,
-                               HFA384x_RID_JOINREQUEST,
-                               &joinreq, HFA384x_RID_JOINREQUEST_LEN);
-                       WLAN_LOG_INFO("linkstatus=DISCONNECTED (re-submitting join)\n");
+                       hfa384x_drvr_setconfig(hw,
+                                              HFA384x_RID_JOINREQUEST,
+                                              &joinreq,
+                                              HFA384x_RID_JOINREQUEST_LEN);
+                       printk(KERN_INFO
+                              "linkstatus=DISCONNECTED (re-submitting join)\n");
                } else {
                        if (wlandev->netdev->type == ARPHRD_ETHER)
-                               WLAN_LOG_INFO("linkstatus=DISCONNECTED (unhandled)\n");
+                               printk(KERN_INFO
+                                      "linkstatus=DISCONNECTED (unhandled)\n");
                }
                wlandev->macmode = WLAN_MACMODE_NONE;
 
@@ -1408,30 +1360,29 @@ void prism2sta_processing_defer(struct work_struct *data)
                 * Indicate Reassociation
                 * Enable Transmits, Receives and pass up data frames
                 */
-               WLAN_LOG_INFO("linkstatus=AP_CHANGE\n");
+               printk(KERN_INFO "linkstatus=AP_CHANGE\n");
 
                result = hfa384x_drvr_getconfig(hw,
                                                HFA384x_RID_CURRENTBSSID,
                                                wlandev->bssid, WLAN_BSSID_LEN);
-               if ( result ) {
-                       WLAN_LOG_DEBUG(1,
-                                      "getconfig(0x%02x) failed, result = %d\n",
-                                      HFA384x_RID_CURRENTBSSID, result);
+               if (result) {
+                       printk(KERN_DEBUG
+                              "getconfig(0x%02x) failed, result = %d\n",
+                              HFA384x_RID_CURRENTBSSID, result);
                        goto failed;
                }
 
                result = hfa384x_drvr_getconfig(hw,
                                                HFA384x_RID_CURRENTSSID,
                                                &ssid, sizeof(ssid));
-               if ( result ) {
-                       WLAN_LOG_DEBUG(1,
-                                      "getconfig(0x%02x) failed, result = %d\n",
-                                      HFA384x_RID_CURRENTSSID, result);
+               if (result) {
+                       printk(KERN_DEBUG
+                              "getconfig(0x%02x) failed, result = %d\n",
+                              HFA384x_RID_CURRENTSSID, result);
                        goto failed;
                }
                prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid,
-                                       (p80211pstrd_t *) &wlandev->ssid);
-
+                                       (p80211pstrd_t *)&wlandev->ssid);
 
                hw->link_status = HFA384x_LINK_CONNECTED;
                netif_carrier_on(wlandev->netdev);
@@ -1450,7 +1401,7 @@ void prism2sta_processing_defer(struct work_struct *data)
                 * Response:
                 * Block Transmits, Ignore receives of data frames
                 */
-               WLAN_LOG_INFO("linkstatus=AP_OUTOFRANGE (unhandled)\n");
+               printk(KERN_INFO "linkstatus=AP_OUTOFRANGE (unhandled)\n");
 
                netif_carrier_off(wlandev->netdev);
 
@@ -1463,7 +1414,7 @@ void prism2sta_processing_defer(struct work_struct *data)
                 * Response:
                 * Enable Transmits, Receives and pass up data frames
                 */
-               WLAN_LOG_INFO("linkstatus=AP_INRANGE\n");
+               printk(KERN_INFO "linkstatus=AP_INRANGE\n");
 
                hw->link_status = HFA384x_LINK_CONNECTED;
                netif_carrier_on(wlandev->netdev);
@@ -1479,17 +1430,18 @@ void prism2sta_processing_defer(struct work_struct *data)
                 * Response:
                 * Disable Transmits, Ignore receives of data frames
                 */
-               if(hw->join_ap && --hw->join_retries > 0)
-               {
-                       hfa384x_JoinRequest_data_t      joinreq;
+               if (hw->join_ap && --hw->join_retries > 0) {
+                       hfa384x_JoinRequest_data_t joinreq;
                        joinreq = hw->joinreq;
                        /* Send the join request */
-                       hfa384x_drvr_setconfig( hw,
-                               HFA384x_RID_JOINREQUEST,
-                               &joinreq, HFA384x_RID_JOINREQUEST_LEN);
-                       WLAN_LOG_INFO("linkstatus=ASSOCFAIL (re-submitting join)\n");
+                       hfa384x_drvr_setconfig(hw,
+                                              HFA384x_RID_JOINREQUEST,
+                                              &joinreq,
+                                              HFA384x_RID_JOINREQUEST_LEN);
+                       printk(KERN_INFO
+                              "linkstatus=ASSOCFAIL (re-submitting join)\n");
                } else {
-                       WLAN_LOG_INFO("linkstatus=ASSOCFAIL (unhandled)\n");
+                       printk(KERN_INFO "linkstatus=ASSOCFAIL (unhandled)\n");
                }
 
                netif_carrier_off(wlandev->netdev);
@@ -1498,8 +1450,8 @@ void prism2sta_processing_defer(struct work_struct *data)
 
        default:
                /* This is bad, IO port problems? */
-               WLAN_LOG_WARNING(
-                       "unknown linkstatus=0x%02x\n", hw->link_status);
+               printk(KERN_WARNING
+                      "unknown linkstatus=0x%02x\n", hw->link_status);
                goto failed;
                break;
        }
@@ -1509,8 +1461,8 @@ void prism2sta_processing_defer(struct work_struct *data)
        p80211wext_event_associated(wlandev, wlandev->linkstatus);
 #endif
 
- failed:
-       DBFEXIT;
+failed:
+       return;
 }
 
 /*----------------------------------------------------------------
@@ -1533,15 +1485,12 @@ void prism2sta_processing_defer(struct work_struct *data)
 static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
                                     hfa384x_InfFrame_t *inf)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
 
-       DBFENTER;
-
-       hw->link_status_new = hfa384x2host_16(inf->info.linkstatus.linkstatus);
+       hw->link_status_new = le16_to_cpu(inf->info.linkstatus.linkstatus);
 
        schedule_work(&hw->link_bh);
 
-       DBFEXIT;
        return;
 }
 
@@ -1566,45 +1515,43 @@ static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
 static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
                                      hfa384x_InfFrame_t *inf)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       hfa384x_AssocStatus_t   rec;
-       int                     i;
-
-       DBFENTER;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       hfa384x_AssocStatus_t rec;
+       int i;
 
        memcpy(&rec, &inf->info.assocstatus, sizeof(rec));
-       rec.assocstatus = hfa384x2host_16(rec.assocstatus);
-       rec.reason      = hfa384x2host_16(rec.reason);
+       rec.assocstatus = le16_to_cpu(rec.assocstatus);
+       rec.reason = le16_to_cpu(rec.reason);
 
        /*
-       ** Find the address in the list of authenticated stations.  If it wasn't
-       ** found, then this address has not been previously authenticated and
-       ** something weird has happened if this is anything other than an
-       ** "authentication failed" message.  If the address was found, then
-       ** set the "associated" flag for that station, based on whether the
-       ** station is associating or losing its association.  Something weird
-       ** has also happened if we find the address in the list of authenticated
-       ** stations but we are getting an "authentication failed" message.
-       */
+        ** Find the address in the list of authenticated stations.  If it wasn't
+        ** found, then this address has not been previously authenticated and
+        ** something weird has happened if this is anything other than an
+        ** "authentication failed" message.  If the address was found, then
+        ** set the "associated" flag for that station, based on whether the
+        ** station is associating or losing its association.  Something weird
+        ** has also happened if we find the address in the list of authenticated
+        ** stations but we are getting an "authentication failed" message.
+        */
 
        for (i = 0; i < hw->authlist.cnt; i++)
-               if (memcmp(rec.sta_addr, hw->authlist.addr[i], WLAN_ADDR_LEN) == 0)
+               if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0)
                        break;
 
        if (i >= hw->authlist.cnt) {
                if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL)
-                       WLAN_LOG_WARNING("assocstatus info frame received for non-authenticated station.\n");
+                       printk(KERN_WARNING
+                              "assocstatus info frame received for non-authenticated station.\n");
        } else {
                hw->authlist.assoc[i] =
-                       (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC ||
-                        rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC);
+                   (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC ||
+                    rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC);
 
                if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL)
-                       WLAN_LOG_WARNING("authfail assocstatus info frame received for authenticated station.\n");
+                       printk(KERN_WARNING
+                              "authfail assocstatus info frame received for authenticated station.\n");
        }
 
-       DBFEXIT;
-
        return;
 }
 
@@ -1630,11 +1577,9 @@ static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
 static void prism2sta_inf_authreq(wlandevice_t *wlandev,
                                  hfa384x_InfFrame_t *inf)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
        struct sk_buff *skb;
 
-       DBFENTER;
-
        skb = dev_alloc_skb(sizeof(*inf));
        if (skb) {
                skb_put(skb, sizeof(*inf));
@@ -1642,132 +1587,129 @@ static void prism2sta_inf_authreq(wlandevice_t *wlandev,
                skb_queue_tail(&hw->authq, skb);
                schedule_work(&hw->link_bh);
        }
-
-       DBFEXIT;
 }
 
 static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
                                        hfa384x_InfFrame_t *inf)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-       hfa384x_authenticateStation_data_t  rec;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+       hfa384x_authenticateStation_data_t rec;
 
-       int    i, added, result, cnt;
-       u8  *addr;
-
-       DBFENTER;
+       int i, added, result, cnt;
+       u8 *addr;
 
        /*
-       ** Build the AuthenticateStation record.  Initialize it for denying
-       ** authentication.
-       */
+        ** Build the AuthenticateStation record.  Initialize it for denying
+        ** authentication.
+        */
 
-       memcpy(rec.address, inf->info.authreq.sta_addr, WLAN_ADDR_LEN);
+       memcpy(rec.address, inf->info.authreq.sta_addr, ETH_ALEN);
        rec.status = P80211ENUM_status_unspec_failure;
 
        /*
-       ** Authenticate based on the access mode.
-       */
+        ** Authenticate based on the access mode.
+        */
 
        switch (hw->accessmode) {
-               case WLAN_ACCESS_NONE:
+       case WLAN_ACCESS_NONE:
 
-                       /*
-                       ** Deny all new authentications.  However, if a station
-                       ** is ALREADY authenticated, then accept it.
-                       */
+               /*
+                ** Deny all new authentications.  However, if a station
+                ** is ALREADY authenticated, then accept it.
+                */
 
-                       for (i = 0; i < hw->authlist.cnt; i++)
-                               if (memcmp(rec.address, hw->authlist.addr[i],
-                                               WLAN_ADDR_LEN) == 0) {
-                                       rec.status = P80211ENUM_status_successful;
-                                       break;
-                               }
+               for (i = 0; i < hw->authlist.cnt; i++)
+                       if (memcmp(rec.address, hw->authlist.addr[i],
+                                  ETH_ALEN) == 0) {
+                               rec.status = P80211ENUM_status_successful;
+                               break;
+                       }
 
-                       break;
+               break;
 
-               case WLAN_ACCESS_ALL:
+       case WLAN_ACCESS_ALL:
 
-                       /*
-                       ** Allow all authentications.
-                       */
+               /*
+                ** Allow all authentications.
+                */
 
-                       rec.status = P80211ENUM_status_successful;
-                       break;
+               rec.status = P80211ENUM_status_successful;
+               break;
 
-               case WLAN_ACCESS_ALLOW:
+       case WLAN_ACCESS_ALLOW:
 
-                       /*
-                       ** Only allow the authentication if the MAC address
-                       ** is in the list of allowed addresses.
-                       **
-                       ** Since this is the interrupt handler, we may be here
-                       ** while the access list is in the middle of being
-                       ** updated.  Choose the list which is currently okay.
-                       ** See "prism2mib_priv_accessallow()" for details.
-                       */
-
-                       if (hw->allow.modify == 0) {
-                               cnt  = hw->allow.cnt;
-                               addr = hw->allow.addr[0];
-                       } else {
-                               cnt  = hw->allow.cnt1;
-                               addr = hw->allow.addr1[0];
+               /*
+                ** Only allow the authentication if the MAC address
+                ** is in the list of allowed addresses.
+                **
+                ** Since this is the interrupt handler, we may be here
+                ** while the access list is in the middle of being
+                ** updated.  Choose the list which is currently okay.
+                ** See "prism2mib_priv_accessallow()" for details.
+                */
+
+               if (hw->allow.modify == 0) {
+                       cnt = hw->allow.cnt;
+                       addr = hw->allow.addr[0];
+               } else {
+                       cnt = hw->allow.cnt1;
+                       addr = hw->allow.addr1[0];
+               }
+
+               for (i = 0; i < cnt; i++, addr += ETH_ALEN)
+                       if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+                               rec.status = P80211ENUM_status_successful;
+                               break;
                        }
 
-                       for (i = 0; i < cnt; i++, addr += WLAN_ADDR_LEN)
-                               if (memcmp(rec.address, addr, WLAN_ADDR_LEN) == 0) {
-                                       rec.status = P80211ENUM_status_successful;
-                                       break;
-                               }
+               break;
 
-                       break;
+       case WLAN_ACCESS_DENY:
 
-               case WLAN_ACCESS_DENY:
+               /*
+                ** Allow the authentication UNLESS the MAC address is
+                ** in the list of denied addresses.
+                **
+                ** Since this is the interrupt handler, we may be here
+                ** while the access list is in the middle of being
+                ** updated.  Choose the list which is currently okay.
+                ** See "prism2mib_priv_accessdeny()" for details.
+                */
 
-                       /*
-                       ** Allow the authentication UNLESS the MAC address is
-                       ** in the list of denied addresses.
-                       **
-                       ** Since this is the interrupt handler, we may be here
-                       ** while the access list is in the middle of being
-                       ** updated.  Choose the list which is currently okay.
-                       ** See "prism2mib_priv_accessdeny()" for details.
-                       */
-
-                       if (hw->deny.modify == 0) {
-                               cnt  = hw->deny.cnt;
-                               addr = hw->deny.addr[0];
-                       } else {
-                               cnt  = hw->deny.cnt1;
-                               addr = hw->deny.addr1[0];
-                       }
+               if (hw->deny.modify == 0) {
+                       cnt = hw->deny.cnt;
+                       addr = hw->deny.addr[0];
+               } else {
+                       cnt = hw->deny.cnt1;
+                       addr = hw->deny.addr1[0];
+               }
 
-                       rec.status = P80211ENUM_status_successful;
+               rec.status = P80211ENUM_status_successful;
 
-                       for (i = 0; i < cnt; i++, addr += WLAN_ADDR_LEN)
-                               if (memcmp(rec.address, addr, WLAN_ADDR_LEN) == 0) {
-                                       rec.status = P80211ENUM_status_unspec_failure;
-                                       break;
-                               }
+               for (i = 0; i < cnt; i++, addr += ETH_ALEN)
+                       if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+                               rec.status = P80211ENUM_status_unspec_failure;
+                               break;
+                       }
 
-                       break;
+               break;
        }
 
        /*
-       ** If the authentication is okay, then add the MAC address to the list
-       ** of authenticated stations.  Don't add the address if it is already in
-       ** the list.  (802.11b does not seem to disallow a station from issuing
-       ** an authentication request when the station is already authenticated.
-       ** Does this sort of thing ever happen?  We might as well do the check
-       ** just in case.)
-       */
+        ** If the authentication is okay, then add the MAC address to the list
+        ** of authenticated stations.  Don't add the address if it is already in
+        ** the list.  (802.11b does not seem to disallow a station from issuing
+        ** an authentication request when the station is already authenticated.
+        ** Does this sort of thing ever happen?  We might as well do the check
+        ** just in case.)
+        */
 
        added = 0;
 
        if (rec.status == P80211ENUM_status_successful) {
                for (i = 0; i < hw->authlist.cnt; i++)
-                       if (memcmp(rec.address, hw->authlist.addr[i], WLAN_ADDR_LEN) == 0)
+                       if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
+                           == 0)
                                break;
 
                if (i >= hw->authlist.cnt) {
@@ -1775,7 +1717,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
                                rec.status = P80211ENUM_status_ap_full;
                        } else {
                                memcpy(hw->authlist.addr[hw->authlist.cnt],
-                                       rec.address, WLAN_ADDR_LEN);
+                                      rec.address, ETH_ALEN);
                                hw->authlist.cnt++;
                                added = 1;
                        }
@@ -1783,27 +1725,26 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
        }
 
        /*
-       ** Send back the results of the authentication.  If this doesn't work,
-       ** then make sure to remove the address from the authenticated list if
-       ** it was added.
-       */
+        ** Send back the results of the authentication.  If this doesn't work,
+        ** then make sure to remove the address from the authenticated list if
+        ** it was added.
+        */
 
-       rec.status = host2hfa384x_16(rec.status);
+       rec.status = cpu_to_le16(rec.status);
        rec.algorithm = inf->info.authreq.algorithm;
 
        result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA,
-                                                       &rec, sizeof(rec));
+                                       &rec, sizeof(rec));
        if (result) {
-               if (added) hw->authlist.cnt--;
-               WLAN_LOG_ERROR("setconfig(authenticatestation) failed, result=%d\n", result);
+               if (added)
+                       hw->authlist.cnt--;
+               printk(KERN_ERR
+                      "setconfig(authenticatestation) failed, result=%d\n",
+                      result);
        }
-
-       DBFEXIT;
-
        return;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_inf_psusercnt
 *
@@ -1825,73 +1766,13 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
 static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
                                    hfa384x_InfFrame_t *inf)
 {
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-
-       DBFENTER;
+       hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
 
-       hw->psusercount = hfa384x2host_16(inf->info.psusercnt.usercnt);
-
-       DBFEXIT;
+       hw->psusercount = le16_to_cpu(inf->info.psusercnt.usercnt);
 
        return;
 }
 
-/*----------------------------------------------------------------
-* prism2sta_ev_dtim
-*
-* Handles the DTIM early warning event.
-*
-* Arguments:
-*      wlandev         wlan device structure
-*
-* Returns:
-*      nothing
-*
-* Side effects:
-*
-* Call context:
-*      interrupt
-----------------------------------------------------------------*/
-void prism2sta_ev_dtim(wlandevice_t *wlandev)
-{
-#if 0
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-#endif
-       DBFENTER;
-       WLAN_LOG_DEBUG(3, "DTIM event, currently unhandled.\n");
-       DBFEXIT;
-       return;
-}
-
-
-/*----------------------------------------------------------------
-* prism2sta_ev_infdrop
-*
-* Handles the InfDrop event.
-*
-* Arguments:
-*      wlandev         wlan device structure
-*
-* Returns:
-*      nothing
-*
-* Side effects:
-*
-* Call context:
-*      interrupt
-----------------------------------------------------------------*/
-void prism2sta_ev_infdrop(wlandevice_t *wlandev)
-{
-#if 0
-        hfa384x_t               *hw = (hfa384x_t *)wlandev->priv;
-#endif
-       DBFENTER;
-       WLAN_LOG_DEBUG(3, "Info frame dropped due to card mem low.\n");
-       DBFEXIT;
-       return;
-}
-
-
 /*----------------------------------------------------------------
 * prism2sta_ev_info
 *
@@ -1911,56 +1792,53 @@ void prism2sta_ev_infdrop(wlandevice_t *wlandev)
 ----------------------------------------------------------------*/
 void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
 {
-       DBFENTER;
-       inf->infotype = hfa384x2host_16(inf->infotype);
+       inf->infotype = le16_to_cpu(inf->infotype);
        /* Dispatch */
-       switch ( inf->infotype ) {
-               case HFA384x_IT_HANDOVERADDR:
-                       prism2sta_inf_handover(wlandev, inf);
-                       break;
-               case HFA384x_IT_COMMTALLIES:
-                       prism2sta_inf_tallies(wlandev, inf);
-                       break;
-               case HFA384x_IT_HOSTSCANRESULTS:
-                        prism2sta_inf_hostscanresults(wlandev, inf);
-                        break;
-               case HFA384x_IT_SCANRESULTS:
-                       prism2sta_inf_scanresults(wlandev, inf);
-                       break;
-               case HFA384x_IT_CHINFORESULTS:
-                       prism2sta_inf_chinforesults(wlandev, inf);
-                       break;
-               case HFA384x_IT_LINKSTATUS:
-                       prism2sta_inf_linkstatus(wlandev, inf);
-                       break;
-               case HFA384x_IT_ASSOCSTATUS:
-                       prism2sta_inf_assocstatus(wlandev, inf);
-                       break;
-               case HFA384x_IT_AUTHREQ:
-                       prism2sta_inf_authreq(wlandev, inf);
-                       break;
-               case HFA384x_IT_PSUSERCNT:
-                       prism2sta_inf_psusercnt(wlandev, inf);
-                       break;
-               case HFA384x_IT_KEYIDCHANGED:
-                       WLAN_LOG_WARNING("Unhandled IT_KEYIDCHANGED\n");
-                       break;
-               case HFA384x_IT_ASSOCREQ:
-                       WLAN_LOG_WARNING("Unhandled IT_ASSOCREQ\n");
-                       break;
-               case HFA384x_IT_MICFAILURE:
-                       WLAN_LOG_WARNING("Unhandled IT_MICFAILURE\n");
-                       break;
-               default:
-                       WLAN_LOG_WARNING(
-                               "Unknown info type=0x%02x\n", inf->infotype);
-                       break;
+       switch (inf->infotype) {
+       case HFA384x_IT_HANDOVERADDR:
+               prism2sta_inf_handover(wlandev, inf);
+               break;
+       case HFA384x_IT_COMMTALLIES:
+               prism2sta_inf_tallies(wlandev, inf);
+               break;
+       case HFA384x_IT_HOSTSCANRESULTS:
+               prism2sta_inf_hostscanresults(wlandev, inf);
+               break;
+       case HFA384x_IT_SCANRESULTS:
+               prism2sta_inf_scanresults(wlandev, inf);
+               break;
+       case HFA384x_IT_CHINFORESULTS:
+               prism2sta_inf_chinforesults(wlandev, inf);
+               break;
+       case HFA384x_IT_LINKSTATUS:
+               prism2sta_inf_linkstatus(wlandev, inf);
+               break;
+       case HFA384x_IT_ASSOCSTATUS:
+               prism2sta_inf_assocstatus(wlandev, inf);
+               break;
+       case HFA384x_IT_AUTHREQ:
+               prism2sta_inf_authreq(wlandev, inf);
+               break;
+       case HFA384x_IT_PSUSERCNT:
+               prism2sta_inf_psusercnt(wlandev, inf);
+               break;
+       case HFA384x_IT_KEYIDCHANGED:
+               printk(KERN_WARNING "Unhandled IT_KEYIDCHANGED\n");
+               break;
+       case HFA384x_IT_ASSOCREQ:
+               printk(KERN_WARNING "Unhandled IT_ASSOCREQ\n");
+               break;
+       case HFA384x_IT_MICFAILURE:
+               printk(KERN_WARNING "Unhandled IT_MICFAILURE\n");
+               break;
+       default:
+               printk(KERN_WARNING
+                      "Unknown info type=0x%02x\n", inf->infotype);
+               break;
        }
-       DBFEXIT;
        return;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_ev_txexc
 *
@@ -1982,15 +1860,11 @@ void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
 ----------------------------------------------------------------*/
 void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status)
 {
-       DBFENTER;
-
-       WLAN_LOG_DEBUG(3, "TxExc status=0x%x.\n", status);
+       pr_debug("TxExc status=0x%x.\n", status);
 
-       DBFEXIT;
        return;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_ev_tx
 *
@@ -2009,15 +1883,12 @@ void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status)
 ----------------------------------------------------------------*/
 void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
 {
-       DBFENTER;
-       WLAN_LOG_DEBUG(4, "Tx Complete, status=0x%04x\n", status);
+       pr_debug("Tx Complete, status=0x%04x\n", status);
        /* update linux network stats */
        wlandev->linux_stats.tx_packets++;
-       DBFEXIT;
        return;
 }
 
-
 /*----------------------------------------------------------------
 * prism2sta_ev_rx
 *
@@ -2036,11 +1907,7 @@ void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
 ----------------------------------------------------------------*/
 void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
 {
-       DBFENTER;
-
        p80211netdev_rx(wlandev, skb);
-
-       DBFEXIT;
        return;
 }
 
@@ -2062,11 +1929,7 @@ void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
 ----------------------------------------------------------------*/
 void prism2sta_ev_alloc(wlandevice_t *wlandev)
 {
-       DBFENTER;
-
        netif_wake_queue(wlandev->netdev);
-
-       DBFEXIT;
        return;
 }
 
@@ -2091,17 +1954,17 @@ void prism2sta_ev_alloc(wlandevice_t *wlandev)
 ----------------------------------------------------------------*/
 static wlandevice_t *create_wlan(void)
 {
-        wlandevice_t    *wlandev = NULL;
-       hfa384x_t       *hw = NULL;
+       wlandevice_t *wlandev = NULL;
+       hfa384x_t *hw = NULL;
 
-       /* Alloc our structures */
-       wlandev =       kmalloc(sizeof(wlandevice_t), GFP_KERNEL);
-       hw =            kmalloc(sizeof(hfa384x_t), GFP_KERNEL);
+       /* Alloc our structures */
+       wlandev = kmalloc(sizeof(wlandevice_t), GFP_KERNEL);
+       hw = kmalloc(sizeof(hfa384x_t), GFP_KERNEL);
 
        if (!wlandev || !hw) {
-               WLAN_LOG_ERROR("%s: Memory allocation failure.\n", dev_info);
-               if (wlandev)    kfree(wlandev);
-               if (hw)         kfree(hw);
+               printk(KERN_ERR "%s: Memory allocation failure.\n", dev_info);
+               kfree(wlandev);
+               kfree(hw);
                return NULL;
        }
 
@@ -2121,24 +1984,21 @@ static wlandevice_t *create_wlan(void)
        wlandev->set_multicast_list = prism2sta_setmulticast;
        wlandev->tx_timeout = hfa384x_tx_timeout;
 
-       wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT |
-                          P80211_NSDCAP_AUTOJOIN;
+       wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | P80211_NSDCAP_AUTOJOIN;
 
        /* Initialize the device private data stucture. */
-        hw->dot11_desired_bss_type = 1;
+       hw->dot11_desired_bss_type = 1;
 
        return wlandev;
 }
 
 void prism2sta_commsqual_defer(struct work_struct *data)
 {
-       hfa384x_t               *hw = container_of(data, struct hfa384x, commsqual_bh);
-        wlandevice_t            *wlandev = hw->wlandev;
+       hfa384x_t *hw = container_of(data, struct hfa384x, commsqual_bh);
+       wlandevice_t *wlandev = hw->wlandev;
        hfa384x_bytestr32_t ssid;
        int result = 0;
 
-       DBFENTER;
-
        if (hw->wlandev->hwremoved)
                goto done;
 
@@ -2155,58 +2015,49 @@ void prism2sta_commsqual_defer(struct work_struct *data)
                                                HFA384x_RID_DBMCOMMSQUALITY_LEN);
 
                if (result) {
-                       WLAN_LOG_ERROR("error fetching commsqual\n");
+                       printk(KERN_ERR "error fetching commsqual\n");
                        goto done;
                }
 
-               // qual.CQ_currBSS; // link
-               // ASL_currBSS;  // level
-               // qual.ANL_currFC; // noise
-
-               WLAN_LOG_DEBUG(3, "commsqual %d %d %d\n",
-                              hfa384x2host_16(hw->qual.CQ_currBSS),
-                              hfa384x2host_16(hw->qual.ASL_currBSS),
-                              hfa384x2host_16(hw->qual.ANL_currFC));
+               pr_debug("commsqual %d %d %d\n",
+                      le16_to_cpu(hw->qual.CQ_currBSS),
+                      le16_to_cpu(hw->qual.ASL_currBSS),
+                      le16_to_cpu(hw->qual.ANL_currFC));
        }
 
        /* Lastly, we need to make sure the BSSID didn't change on us */
        result = hfa384x_drvr_getconfig(hw,
                                        HFA384x_RID_CURRENTBSSID,
                                        wlandev->bssid, WLAN_BSSID_LEN);
-       if ( result ) {
-               WLAN_LOG_DEBUG(1,
-                              "getconfig(0x%02x) failed, result = %d\n",
-                              HFA384x_RID_CURRENTBSSID, result);
+       if (result) {
+               printk(KERN_DEBUG
+                      "getconfig(0x%02x) failed, result = %d\n",
+                      HFA384x_RID_CURRENTBSSID, result);
                goto done;
        }
 
        result = hfa384x_drvr_getconfig(hw,
                                        HFA384x_RID_CURRENTSSID,
                                        &ssid, sizeof(ssid));
-       if ( result ) {
-               WLAN_LOG_DEBUG(1,
-                              "getconfig(0x%02x) failed, result = %d\n",
-                              HFA384x_RID_CURRENTSSID, result);
+       if (result) {
+               printk(KERN_DEBUG
+                      "getconfig(0x%02x) failed, result = %d\n",
+                      HFA384x_RID_CURRENTSSID, result);
                goto done;
        }
        prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid,
-                               (p80211pstrd_t *) &wlandev->ssid);
-
+                               (p80211pstrd_t *)&wlandev->ssid);
 
        /* Reschedule timer */
        mod_timer(&hw->commsqual_timer, jiffies + HZ);
 
- done:
-       DBFEXIT;
+done:
+       ;
 }
 
 void prism2sta_commsqual_timer(unsigned long data)
 {
-        hfa384x_t               *hw = (hfa384x_t *) data;
-
-       DBFENTER;
+       hfa384x_t *hw = (hfa384x_t *) data;
 
        schedule_work(&hw->commsqual_bh);
-
-       DBFEXIT;
 }