]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/ipw2100.c
Pull 1024-cpu into release branch
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / ipw2100.c
index d296d464946f0ba37b388e4936947a6725aff23d..2414e6493aa5639ad88aaa829395976c404fa972 100644 (file)
@@ -106,7 +106,7 @@ that protects the following:
 
   tx_pend_list : Holds used Tx buffers waiting to go into the TBD ring
     TAIL modified ipw2100_tx()
-    HEAD modified by X__ipw2100_tx_send_data()
+    HEAD modified by ipw2100_tx_send_data()
 
   msg_free_list : Holds pre-allocated Msg (Command) buffers
     TAIL modified in __ipw2100_tx_process()
@@ -114,7 +114,7 @@ that protects the following:
 
   msg_pend_list : Holds used Msg buffers waiting to go into the TBD ring
     TAIL modified in ipw2100_hw_send_command()
-    HEAD modified in X__ipw2100_tx_send_commands()
+    HEAD modified in ipw2100_tx_send_commands()
 
   The flow of data on the TX side is as follows:
 
@@ -146,6 +146,7 @@ that only one external action is invoked at a time.
 #include <linux/netdevice.h>
 #include <linux/ethtool.h>
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
 #include <linux/proc_fs.h>
 #include <linux/skbuff.h>
 #include <asm/uaccess.h>
@@ -206,7 +207,20 @@ MODULE_PARM_DESC(channel, "channel");
 MODULE_PARM_DESC(associate, "auto associate when scanning (default on)");
 MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
 
-u32 ipw2100_debug_level = IPW_DL_NONE;
+static u32 ipw2100_debug_level = IPW_DL_NONE;
+
+#ifdef CONFIG_IPW_DEBUG
+#define IPW_DEBUG(level, message...) \
+do { \
+       if (ipw2100_debug_level & (level)) { \
+               printk(KERN_DEBUG "ipw2100: %c %s ", \
+                       in_interrupt() ? 'I' : 'U',  __FUNCTION__); \
+               printk(message); \
+       } \
+} while (0)
+#else
+#define IPW_DEBUG(level, message...) do {} while (0)
+#endif /* CONFIG_IPW_DEBUG */
 
 #ifdef CONFIG_IPW_DEBUG
 static const char *command_types[] = {
@@ -286,49 +300,65 @@ static const char *command_types[] = {
 
 
 /* Pre-decl until we get the code solid and then we can clean it up */
-static void X__ipw2100_tx_send_commands(struct ipw2100_priv *priv);
-static void X__ipw2100_tx_send_data(struct ipw2100_priv *priv);
+static void ipw2100_tx_send_commands(struct ipw2100_priv *priv);
+static void ipw2100_tx_send_data(struct ipw2100_priv *priv);
 static int ipw2100_adapter_setup(struct ipw2100_priv *priv);
 
 static void ipw2100_queues_initialize(struct ipw2100_priv *priv);
 static void ipw2100_queues_free(struct ipw2100_priv *priv);
 static int ipw2100_queues_allocate(struct ipw2100_priv *priv);
 
+static int ipw2100_fw_download(struct ipw2100_priv *priv,
+                              struct ipw2100_fw *fw);
+static int ipw2100_get_firmware(struct ipw2100_priv *priv,
+                               struct ipw2100_fw *fw);
+static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf,
+                                size_t max);
+static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf,
+                                   size_t max);
+static void ipw2100_release_firmware(struct ipw2100_priv *priv,
+                                    struct ipw2100_fw *fw);
+static int ipw2100_ucode_download(struct ipw2100_priv *priv,
+                                 struct ipw2100_fw *fw);
+static void ipw2100_wx_event_work(struct ipw2100_priv *priv);
+static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev);
+static struct iw_handler_def ipw2100_wx_handler_def;
+
 
 static inline void read_register(struct net_device *dev, u32 reg, u32 *val)
 {
-       *val = readl((void *)(dev->base_addr + reg));
+       *val = readl((void __iomem *)(dev->base_addr + reg));
        IPW_DEBUG_IO("r: 0x%08X => 0x%08X\n", reg, *val);
 }
 
 static inline void write_register(struct net_device *dev, u32 reg, u32 val)
 {
-       writel(val, (void *)(dev->base_addr + reg));
+       writel(val, (void __iomem *)(dev->base_addr + reg));
        IPW_DEBUG_IO("w: 0x%08X <= 0x%08X\n", reg, val);
 }
 
 static inline void read_register_word(struct net_device *dev, u32 reg, u16 *val)
 {
-       *val = readw((void *)(dev->base_addr + reg));
+       *val = readw((void __iomem *)(dev->base_addr + reg));
        IPW_DEBUG_IO("r: 0x%08X => %04X\n", reg, *val);
 }
 
 static inline void read_register_byte(struct net_device *dev, u32 reg, u8 *val)
 {
-       *val = readb((void *)(dev->base_addr + reg));
+       *val = readb((void __iomem *)(dev->base_addr + reg));
        IPW_DEBUG_IO("r: 0x%08X => %02X\n", reg, *val);
 }
 
 static inline void write_register_word(struct net_device *dev, u32 reg, u16 val)
 {
-       writew(val, (void *)(dev->base_addr + reg));
+       writew(val, (void __iomem *)(dev->base_addr + reg));
        IPW_DEBUG_IO("w: 0x%08X <= %04X\n", reg, val);
 }
 
 
 static inline void write_register_byte(struct net_device *dev, u32 reg, u8 val)
 {
-       writeb(val, (void *)(dev->base_addr + reg));
+       writeb(val, (void __iomem *)(dev->base_addr + reg));
        IPW_DEBUG_IO("w: 0x%08X =< %02X\n", reg, val);
 }
 
@@ -468,12 +498,12 @@ static inline void read_nic_memory(struct net_device *dev, u32 addr, u32 len,
 static inline int ipw2100_hw_is_adapter_in_system(struct net_device *dev)
 {
        return (dev->base_addr &&
-               (readl((void *)(dev->base_addr + IPW_REG_DOA_DEBUG_AREA_START))
+               (readl((void __iomem *)(dev->base_addr + IPW_REG_DOA_DEBUG_AREA_START))
                 == IPW_DATA_DOA_DEBUG_VALUE));
 }
 
-int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
-                       void *val, u32 *len)
+static int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
+                              void *val, u32 *len)
 {
        struct ipw2100_ordinals *ordinals = &priv->ordinals;
        u32 addr;
@@ -483,7 +513,7 @@ int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
        u32 total_length;
 
        if (ordinals->table1_addr == 0) {
-               IPW_DEBUG_WARNING(DRV_NAME ": attempt to use fw ordinals "
+               printk(KERN_WARNING DRV_NAME ": attempt to use fw ordinals "
                       "before they have been loaded.\n");
                return -EINVAL;
        }
@@ -492,8 +522,8 @@ int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
                if (*len < IPW_ORD_TAB_1_ENTRY_SIZE) {
                        *len = IPW_ORD_TAB_1_ENTRY_SIZE;
 
-                       IPW_DEBUG_WARNING(DRV_NAME
-                              ": ordinal buffer length too small, need %d\n",
+                       printk(KERN_WARNING DRV_NAME
+                              ": ordinal buffer length too small, need %zd\n",
                               IPW_ORD_TAB_1_ENTRY_SIZE);
 
                        return -EINVAL;
@@ -545,7 +575,7 @@ int ipw2100_get_ordinal(struct ipw2100_priv *priv, u32 ord,
                return 0;
        }
 
-       IPW_DEBUG_WARNING(DRV_NAME ": ordinal %d neither in table 1 nor "
+       printk(KERN_WARNING DRV_NAME ": ordinal %d neither in table 1 nor "
               "in table 2\n", ord);
 
        return -EINVAL;
@@ -735,8 +765,8 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
        list_add_tail(element, &priv->msg_pend_list);
        INC_STAT(&priv->msg_pend_stat);
 
-       X__ipw2100_tx_send_commands(priv);
-       X__ipw2100_tx_send_data(priv);
+       ipw2100_tx_send_commands(priv);
+       ipw2100_tx_send_data(priv);
 
        spin_unlock_irqrestore(&priv->low_lock, flags);
 
@@ -760,7 +790,7 @@ static int ipw2100_hw_send_command(struct ipw2100_priv *priv,
        }
 
        if (priv->fatal_error) {
-               IPW_DEBUG_WARNING("%s: firmware fatal error\n",
+               printk(KERN_WARNING DRV_NAME ": %s: firmware fatal error\n",
                       priv->net_dev->name);
                return -EIO;
        }
@@ -915,18 +945,16 @@ static int sw_reset_and_clock(struct ipw2100_priv *priv)
        if (i == 10000)
                return -EIO;    /* TODO: better error value */
 
-//#if CONFIG_IPW2100_D0ENABLED
        /* set D0 standby bit */
        read_register(priv->net_dev, IPW_REG_GP_CNTRL, &r);
        write_register(priv->net_dev, IPW_REG_GP_CNTRL,
                       r | IPW_AUX_HOST_GP_CNTRL_BIT_HOST_ALLOWS_STANDBY);
-//#endif
 
        return 0;
 }
 
 /*********************************************************************
-    Procedure   :   ipw2100_ipw2100_download_firmware
+    Procedure   :   ipw2100_download_firmware
     Purpose     :   Initiaze adapter after power on.
                     The sequence is:
                     1. assert s/w reset first!
@@ -1000,7 +1028,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
        /* load microcode */
        err = ipw2100_ucode_download(priv, &ipw2100_firmware);
        if (err) {
-               IPW_DEBUG_ERROR("%s: Error loading microcode: %d\n",
+               printk(KERN_ERR DRV_NAME ": %s: Error loading microcode: %d\n",
                       priv->net_dev->name, err);
                goto fail;
        }
@@ -1013,7 +1041,7 @@ static int ipw2100_download_firmware(struct ipw2100_priv *priv)
        /* s/w reset and clock stabilization (again!!!) */
        err = sw_reset_and_clock(priv);
        if (err) {
-               IPW_DEBUG_ERROR("%s: sw_reset_and_clock failed: %d\n",
+               printk(KERN_ERR DRV_NAME ": %s: sw_reset_and_clock failed: %d\n",
                       priv->net_dev->name, err);
                goto fail;
        }
@@ -1117,7 +1145,6 @@ static inline int rf_kill_active(struct ipw2100_priv *priv)
 {
 #define MAX_RF_KILL_CHECKS 5
 #define RF_KILL_CHECK_DELAY 40
-#define RF_KILL_CHECK_THRESHOLD 3
 
        unsigned short value = 0;
        u32 reg = 0;
@@ -1194,7 +1221,6 @@ static int ipw2100_get_hw_features(struct ipw2100_priv *priv)
  */
 static int ipw2100_start_adapter(struct ipw2100_priv *priv)
 {
-#define IPW_WAIT_FW_INIT_COMPLETE_DELAY (40 * HZ / 1000)
        int i;
        u32 inta, inta_mask, gpio;
 
@@ -1209,7 +1235,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
         * fw & dino ucode
         */
        if (ipw2100_download_firmware(priv)) {
-               IPW_DEBUG_ERROR("%s: Failed to power on the adapter.\n",
+               printk(KERN_ERR DRV_NAME ": %s: Failed to power on the adapter.\n",
                       priv->net_dev->name);
                return -EIO;
        }
@@ -1231,7 +1257,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
        i = 5000;
        do {
                set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(IPW_WAIT_FW_INIT_COMPLETE_DELAY);
+               schedule_timeout(40 * HZ / 1000);
                /* Todo... wait for sync command ... */
 
                read_register(priv->net_dev, IPW_REG_INTA, &inta);
@@ -1269,7 +1295,7 @@ static int ipw2100_start_adapter(struct ipw2100_priv *priv)
                     i ? "SUCCESS" : "FAILED");
 
        if (!i) {
-               IPW_DEBUG_WARNING("%s: Firmware did not initialize.\n",
+               printk(KERN_WARNING DRV_NAME ": %s: Firmware did not initialize.\n",
                       priv->net_dev->name);
                return -EIO;
        }
@@ -1465,7 +1491,7 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
 
                err = ipw2100_hw_phy_off(priv);
                if (err)
-                       IPW_DEBUG_WARNING("Error disabling radio %d\n", err);
+                       printk(KERN_WARNING DRV_NAME ": Error disabling radio %d\n", err);
 
                /*
                 * If in D0-standby mode going directly to D3 may cause a
@@ -1491,7 +1517,7 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
 
                err = ipw2100_hw_send_command(priv, &cmd);
                if (err)
-                       IPW_DEBUG_WARNING(
+                       printk(KERN_WARNING DRV_NAME ": "
                               "%s: Power down command failed: Error %d\n",
                               priv->net_dev->name, err);
                else {
@@ -1532,7 +1558,7 @@ static int ipw2100_hw_stop_adapter(struct ipw2100_priv *priv)
        }
 
        if (i == 0)
-               IPW_DEBUG_WARNING(DRV_NAME
+               printk(KERN_WARNING DRV_NAME
                       ": %s: Could now power down adapter.\n",
                       priv->net_dev->name);
 
@@ -1572,13 +1598,13 @@ static int ipw2100_disable_adapter(struct ipw2100_priv *priv)
 
        err = ipw2100_hw_send_command(priv, &cmd);
        if (err) {
-               IPW_DEBUG_WARNING("exit - failed to send CARD_DISABLE command\n");
+               printk(KERN_WARNING DRV_NAME ": exit - failed to send CARD_DISABLE command\n");
                goto fail_up;
        }
 
        err = ipw2100_wait_for_card_state(priv, IPW_HW_STATE_DISABLED);
        if (err) {
-               IPW_DEBUG_WARNING("exit - card failed to change to DISABLED\n");
+               printk(KERN_WARNING DRV_NAME ": exit - card failed to change to DISABLED\n");
                goto fail_up;
        }
 
@@ -1589,7 +1615,7 @@ fail_up:
        return err;
 }
 
-int ipw2100_set_scan_options(struct ipw2100_priv *priv)
+static int ipw2100_set_scan_options(struct ipw2100_priv *priv)
 {
        struct host_command cmd = {
                .host_command = SET_SCAN_OPTIONS,
@@ -1621,7 +1647,7 @@ int ipw2100_set_scan_options(struct ipw2100_priv *priv)
        return err;
 }
 
-int ipw2100_start_scan(struct ipw2100_priv *priv)
+static int ipw2100_start_scan(struct ipw2100_priv *priv)
 {
        struct host_command cmd = {
                .host_command = BROADCAST_SCAN,
@@ -1688,7 +1714,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
            (priv->status & STATUS_RESET_PENDING)) {
                /* Power cycle the card ... */
                if (ipw2100_power_cycle_adapter(priv)) {
-                       IPW_DEBUG_WARNING("%s: Could not cycle adapter.\n",
+                       printk(KERN_WARNING DRV_NAME ": %s: Could not cycle adapter.\n",
                                          priv->net_dev->name);
                        rc = 1;
                        goto exit;
@@ -1696,9 +1722,9 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
        } else
                priv->status |= STATUS_POWERED;
 
-       /* Load the firmeware, start the clocks, etc. */
+       /* Load the firmware, start the clocks, etc. */
        if (ipw2100_start_adapter(priv)) {
-               IPW_DEBUG_ERROR("%s: Failed to start the firmware.\n",
+               printk(KERN_ERR DRV_NAME ": %s: Failed to start the firmware.\n",
                                priv->net_dev->name);
                rc = 1;
                goto exit;
@@ -1708,7 +1734,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
 
        /* Determine capabilities of this particular HW configuration */
        if (ipw2100_get_hw_features(priv)) {
-               IPW_DEBUG_ERROR("%s: Failed to determine HW features.\n",
+               printk(KERN_ERR DRV_NAME ": %s: Failed to determine HW features.\n",
                                priv->net_dev->name);
                rc = 1;
                goto exit;
@@ -1716,7 +1742,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
 
        lock = LOCK_NONE;
        if (ipw2100_set_ordinal(priv, IPW_ORD_PERS_DB_LOCK, &lock, &ord_len)) {
-               IPW_DEBUG_ERROR("%s: Failed to clear ordinal lock.\n",
+               printk(KERN_ERR DRV_NAME ": %s: Failed to clear ordinal lock.\n",
                                priv->net_dev->name);
                rc = 1;
                goto exit;
@@ -1742,7 +1768,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
        /* Send all of the commands that must be sent prior to
         * HOST_COMPLETE */
        if (ipw2100_adapter_setup(priv)) {
-               IPW_DEBUG_ERROR("%s: Failed to start the card.\n",
+               printk(KERN_ERR DRV_NAME ": %s: Failed to start the card.\n",
                                priv->net_dev->name);
                rc = 1;
                goto exit;
@@ -1751,7 +1777,7 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
        if (!deferred) {
                /* Enable the adapter - sends HOST_COMPLETE */
                if (ipw2100_enable_adapter(priv)) {
-                       IPW_DEBUG_ERROR(
+                       printk(KERN_ERR DRV_NAME ": "
                                "%s: failed in call to enable adapter.\n",
                                priv->net_dev->name);
                        ipw2100_hw_stop_adapter(priv);
@@ -1809,7 +1835,7 @@ static void ipw2100_down(struct ipw2100_priv *priv)
        spin_unlock_irqrestore(&priv->low_lock, flags);
 
        if (ipw2100_hw_stop_adapter(priv))
-               IPW_DEBUG_ERROR("%s: Error stopping adapter.\n",
+               printk(KERN_ERR DRV_NAME ": %s: Error stopping adapter.\n",
                       priv->net_dev->name);
 
        /* Do not disable the interrupt until _after_ we disable
@@ -1836,7 +1862,7 @@ static void ipw2100_down(struct ipw2100_priv *priv)
        netif_stop_queue(priv->net_dev);
 }
 
-void ipw2100_reset_adapter(struct ipw2100_priv *priv)
+static void ipw2100_reset_adapter(struct ipw2100_priv *priv)
 {
        unsigned long flags;
        union iwreq_data wrqu = {
@@ -1966,8 +1992,8 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
 }
 
 
-int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
-                     int length, int batch_mode)
+static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
+                            int length, int batch_mode)
 {
        int ssid_len = min(length, IW_ESSID_MAX_SIZE);
        struct host_command cmd = {
@@ -2098,20 +2124,20 @@ static void isr_indicate_scanning(struct ipw2100_priv *priv, u32 status)
        priv->status |= STATUS_SCANNING;
 }
 
-const struct ipw2100_status_indicator status_handlers[] = {
-       IPW2100_HANDLER(IPW_STATE_INITIALIZED, 0),
-       IPW2100_HANDLER(IPW_STATE_COUNTRY_FOUND, 0),
+static const struct ipw2100_status_indicator status_handlers[] = {
+       IPW2100_HANDLER(IPW_STATE_INITIALIZED, NULL),
+       IPW2100_HANDLER(IPW_STATE_COUNTRY_FOUND, NULL),
        IPW2100_HANDLER(IPW_STATE_ASSOCIATED, isr_indicate_associated),
        IPW2100_HANDLER(IPW_STATE_ASSN_LOST, isr_indicate_association_lost),
-       IPW2100_HANDLER(IPW_STATE_ASSN_CHANGED, 0),
+       IPW2100_HANDLER(IPW_STATE_ASSN_CHANGED, NULL),
        IPW2100_HANDLER(IPW_STATE_SCAN_COMPLETE, isr_scan_complete),
-       IPW2100_HANDLER(IPW_STATE_ENTERED_PSP, 0),
-       IPW2100_HANDLER(IPW_STATE_LEFT_PSP, 0),
+       IPW2100_HANDLER(IPW_STATE_ENTERED_PSP, NULL),
+       IPW2100_HANDLER(IPW_STATE_LEFT_PSP, NULL),
        IPW2100_HANDLER(IPW_STATE_RF_KILL, isr_indicate_rf_kill),
-       IPW2100_HANDLER(IPW_STATE_DISABLED, 0),
-       IPW2100_HANDLER(IPW_STATE_POWER_DOWN, 0),
+       IPW2100_HANDLER(IPW_STATE_DISABLED, NULL),
+       IPW2100_HANDLER(IPW_STATE_POWER_DOWN, NULL),
        IPW2100_HANDLER(IPW_STATE_SCANNING, isr_indicate_scanning),
-       IPW2100_HANDLER(-1, 0)
+       IPW2100_HANDLER(-1, NULL)
 };
 
 
@@ -2166,7 +2192,7 @@ static void isr_rx_complete_command(
 }
 
 #ifdef CONFIG_IPW_DEBUG
-const char *frame_types[] = {
+static const char *frame_types[] = {
        "COMMAND_STATUS_VAL",
        "STATUS_CHANGE_VAL",
        "P80211_DATA_VAL",
@@ -2286,7 +2312,7 @@ static inline u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 *in_buf,
  *
  */
 #ifdef CONFIG_IPW2100_RX_DEBUG
-u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH];
+static u8 packet_data[IPW_RX_NIC_BUFFER_LENGTH];
 #endif
 
 static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv,
@@ -2302,7 +2328,7 @@ static inline void ipw2100_corruption_detected(struct ipw2100_priv *priv,
 #endif
 
        IPW_DEBUG_INFO(DRV_NAME ": PCI latency error detected at "
-                      "0x%04X.\n", i * sizeof(struct ipw2100_status));
+                      "0x%04zX.\n", i * sizeof(struct ipw2100_status));
 
 #ifdef ACPI_CSTATE_LIMIT_DEFINED
        IPW_DEBUG_INFO(DRV_NAME ": Disabling C3 transitions.\n");
@@ -2398,7 +2424,7 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i,
        /* Make a copy of the frame so we can dump it to the logs if
         * ieee80211_rx fails */
        memcpy(packet_data, packet->skb->data,
-              min(status->frame_size, IPW_RX_NIC_BUFFER_LENGTH));
+              min_t(u32, status->frame_size, IPW_RX_NIC_BUFFER_LENGTH));
 #endif
 
        if (!ieee80211_rx(priv->ieee, packet->skb, stats)) {
@@ -2416,7 +2442,7 @@ static inline void isr_rx(struct ipw2100_priv *priv, int i,
 
        /* We need to allocate a new SKB and attach it to the RDB. */
        if (unlikely(ipw2100_alloc_skb(priv, packet))) {
-               IPW_DEBUG_WARNING(
+               printk(KERN_WARNING DRV_NAME ": "
                        "%s: Unable to allocate SKB onto RBD ring - disabling "
                        "adapter.\n", priv->net_dev->name);
                /* TODO: schedule adapter shutdown */
@@ -2678,7 +2704,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
                break;
 
        default:
-               IPW_DEBUG_WARNING("%s: Bad fw_pend_list entry!\n",
+               printk(KERN_WARNING DRV_NAME ": %s: Bad fw_pend_list entry!\n",
                                   priv->net_dev->name);
                return 0;
        }
@@ -2692,7 +2718,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
        read_register(priv->net_dev, IPW_MEM_HOST_SHARED_TX_QUEUE_WRITE_INDEX,
                      &w);
        if (w != txq->next)
-               IPW_DEBUG_WARNING("%s: write index mismatch\n",
+               printk(KERN_WARNING DRV_NAME ": %s: write index mismatch\n",
                       priv->net_dev->name);
 
         /*
@@ -2730,21 +2756,21 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
        {
                int i = txq->oldest;
                IPW_DEBUG_TX(
-                       "TX%d V=%p P=%p T=%p L=%d\n", i,
+                       "TX%d V=%p P=%04X T=%04X L=%d\n", i,
                        &txq->drv[i],
-                       (void*)txq->nic + i * sizeof(struct ipw2100_bd),
-                       (void*)txq->drv[i].host_addr,
+                       (u32)(txq->nic + i * sizeof(struct ipw2100_bd)),
+                       txq->drv[i].host_addr,
                        txq->drv[i].buf_length);
 
                if (packet->type == DATA) {
                        i = (i + 1) % txq->entries;
 
                        IPW_DEBUG_TX(
-                               "TX%d V=%p P=%p T=%p L=%d\n", i,
+                               "TX%d V=%p P=%04X T=%04X L=%d\n", i,
                                &txq->drv[i],
-                               (void*)txq->nic + i *
-                               sizeof(struct ipw2100_bd),
-                               (void*)txq->drv[i].host_addr,
+                               (u32)(txq->nic + i *
+                               sizeof(struct ipw2100_bd)),
+                               (u32)txq->drv[i].host_addr,
                                txq->drv[i].buf_length);
                }
        }
@@ -2753,7 +2779,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
        switch (packet->type) {
        case DATA:
                if (txq->drv[txq->oldest].status.info.fields.txType != 0)
-                       IPW_DEBUG_WARNING("%s: Queue mismatch.  "
+                       printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch.  "
                               "Expecting DATA TBD but pulled "
                               "something else: ids %d=%d.\n",
                               priv->net_dev->name, txq->oldest, packet->index);
@@ -2800,7 +2826,7 @@ static inline int __ipw2100_tx_process(struct ipw2100_priv *priv)
 
        case COMMAND:
                if (txq->drv[txq->oldest].status.info.fields.txType != 1)
-                       IPW_DEBUG_WARNING("%s: Queue mismatch.  "
+                       printk(KERN_WARNING DRV_NAME ": %s: Queue mismatch.  "
                               "Expecting COMMAND TBD but pulled "
                               "something else: ids %d=%d.\n",
                               priv->net_dev->name, txq->oldest, packet->index);
@@ -2840,14 +2866,14 @@ static inline void __ipw2100_tx_complete(struct ipw2100_priv *priv)
        while (__ipw2100_tx_process(priv) && i < 200) i++;
 
        if (i == 200) {
-               IPW_DEBUG_WARNING(
+               printk(KERN_WARNING DRV_NAME ": "
                       "%s: Driver is running slow (%d iters).\n",
                       priv->net_dev->name, i);
        }
 }
 
 
-static void X__ipw2100_tx_send_commands(struct ipw2100_priv *priv)
+static void ipw2100_tx_send_commands(struct ipw2100_priv *priv)
 {
        struct list_head *element;
        struct ipw2100_tx_packet *packet;
@@ -2915,10 +2941,10 @@ static void X__ipw2100_tx_send_commands(struct ipw2100_priv *priv)
 
 
 /*
- * X__ipw2100_tx_send_data
+ * ipw2100_tx_send_data
  *
  */
-static void X__ipw2100_tx_send_data(struct ipw2100_priv *priv)
+static void ipw2100_tx_send_data(struct ipw2100_priv *priv)
 {
        struct list_head *element;
        struct ipw2100_tx_packet *packet;
@@ -3084,7 +3110,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
                      (unsigned long)inta & IPW_INTERRUPT_MASK);
 
        if (inta & IPW2100_INTA_FATAL_ERROR) {
-               IPW_DEBUG_WARNING(DRV_NAME
+               printk(KERN_WARNING DRV_NAME
                                  ": Fatal interrupt. Scheduling firmware restart.\n");
                priv->inta_other++;
                write_register(
@@ -3104,7 +3130,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
        }
 
        if (inta & IPW2100_INTA_PARITY_ERROR) {
-               IPW_DEBUG_ERROR("***** PARITY ERROR INTERRUPT !!!! \n");
+               printk(KERN_ERR DRV_NAME ": ***** PARITY ERROR INTERRUPT !!!! \n");
                priv->inta_other++;
                write_register(
                        dev, IPW_REG_INTA,
@@ -3133,8 +3159,8 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv)
                               IPW2100_INTA_TX_TRANSFER);
 
                __ipw2100_tx_complete(priv);
-               X__ipw2100_tx_send_commands(priv);
-               X__ipw2100_tx_send_data(priv);
+               ipw2100_tx_send_commands(priv);
+               ipw2100_tx_send_data(priv);
        }
 
        if (inta & IPW2100_INTA_TX_COMPLETE) {
@@ -3222,7 +3248,7 @@ static irqreturn_t ipw2100_interrupt(int irq, void *data,
 
        if (inta == 0xFFFFFFFF) {
                /* Hardware disappeared */
-               IPW_DEBUG_WARNING("IRQ INTA == 0xFFFFFFFF\n");
+               printk(KERN_WARNING DRV_NAME ": IRQ INTA == 0xFFFFFFFF\n");
                goto none;
        }
 
@@ -3285,7 +3311,7 @@ static int ipw2100_tx(struct ieee80211_txb *txb, struct net_device *dev)
        list_add_tail(element, &priv->tx_pend_list);
        INC_STAT(&priv->tx_pend_stat);
 
-       X__ipw2100_tx_send_data(priv);
+       ipw2100_tx_send_data(priv);
 
        spin_unlock_irqrestore(&priv->low_lock, flags);
        return 0;
@@ -3307,7 +3333,7 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
                IPW_COMMAND_POOL_SIZE * sizeof(struct ipw2100_tx_packet),
                GFP_KERNEL);
        if (!priv->msg_buffers) {
-               IPW_DEBUG_ERROR("%s: PCI alloc failed for msg "
+               printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for msg "
                       "buffers.\n", priv->net_dev->name);
                return -ENOMEM;
        }
@@ -3318,7 +3344,7 @@ static int ipw2100_msg_allocate(struct ipw2100_priv *priv)
                        sizeof(struct ipw2100_cmd_header),
                        &p);
                if (!v) {
-                       IPW_DEBUG_ERROR(
+                       printk(KERN_ERR DRV_NAME ": "
                               "%s: PCI alloc failed for msg "
                               "buffers.\n",
                               priv->net_dev->name);
@@ -3383,7 +3409,8 @@ static void ipw2100_msg_free(struct ipw2100_priv *priv)
        priv->msg_buffers = NULL;
 }
 
-static ssize_t show_pci(struct device *d, char *buf)
+static ssize_t show_pci(struct device *d, struct device_attribute *attr,
+                       char *buf)
 {
        struct pci_dev *pci_dev = container_of(d, struct pci_dev, dev);
        char *out = buf;
@@ -3403,30 +3430,33 @@ static ssize_t show_pci(struct device *d, char *buf)
 }
 static DEVICE_ATTR(pci, S_IRUGO, show_pci, NULL);
 
-static ssize_t show_cfg(struct device *d, char *buf)
+static ssize_t show_cfg(struct device *d, struct device_attribute *attr,
+                       char *buf)
 {
-       struct ipw2100_priv *p = (struct ipw2100_priv *)d->driver_data;
+       struct ipw2100_priv *p = d->driver_data;
        return sprintf(buf, "0x%08x\n", (int)p->config);
 }
 static DEVICE_ATTR(cfg, S_IRUGO, show_cfg, NULL);
 
-static ssize_t show_status(struct device *d, char *buf)
+static ssize_t show_status(struct device *d, struct device_attribute *attr,
+                       char *buf)
 {
-       struct ipw2100_priv *p = (struct ipw2100_priv *)d->driver_data;
+       struct ipw2100_priv *p = d->driver_data;
        return sprintf(buf, "0x%08x\n", (int)p->status);
 }
 static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
 
-static ssize_t show_capability(struct device *d, char *buf)
+static ssize_t show_capability(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
-       struct ipw2100_priv *p = (struct ipw2100_priv *)d->driver_data;
+       struct ipw2100_priv *p = d->driver_data;
        return sprintf(buf, "0x%08x\n", (int)p->capability);
 }
 static DEVICE_ATTR(capability, S_IRUGO, show_capability, NULL);
 
 
 #define IPW2100_REG(x) { IPW_ ##x, #x }
-const struct {
+static const struct {
        u32 addr;
        const char *name;
 } hw_data[] = {
@@ -3437,7 +3467,7 @@ const struct {
        IPW2100_REG(REG_RESET_REG),
 };
 #define IPW2100_NIC(x, s) { x, #x, s }
-const struct {
+static const struct {
        u32 addr;
        const char *name;
        size_t size;
@@ -3447,7 +3477,7 @@ const struct {
        IPW2100_NIC(0x210000, 1),
 };
 #define IPW2100_ORD(x, d) { IPW_ORD_ ##x, #x, d }
-const struct {
+static const struct {
        u8 index;
        const char *name;
        const char *desc;
@@ -3602,7 +3632,8 @@ const struct {
 };
 
 
-static ssize_t show_registers(struct device *d, char *buf)
+static ssize_t show_registers(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        int i;
        struct ipw2100_priv *priv = dev_get_drvdata(d);
@@ -3623,7 +3654,8 @@ static ssize_t show_registers(struct device *d, char *buf)
 static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL);
 
 
-static ssize_t show_hardware(struct device *d, char *buf)
+static ssize_t show_hardware(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        struct net_device *dev = priv->net_dev;
@@ -3663,7 +3695,8 @@ static ssize_t show_hardware(struct device *d, char *buf)
 static DEVICE_ATTR(hardware, S_IRUGO, show_hardware, NULL);
 
 
-static ssize_t show_memory(struct device *d, char *buf)
+static ssize_t show_memory(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        struct net_device *dev = priv->net_dev;
@@ -3716,7 +3749,8 @@ static ssize_t show_memory(struct device *d, char *buf)
        return len;
 }
 
-static ssize_t store_memory(struct device *d, const char *buf, size_t count)
+static ssize_t store_memory(struct device *d, struct device_attribute *attr,
+                               const char *buf, size_t count)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        struct net_device *dev = priv->net_dev;
@@ -3752,7 +3786,8 @@ static ssize_t store_memory(struct device *d, const char *buf, size_t count)
 static DEVICE_ATTR(memory, S_IWUSR|S_IRUGO, show_memory, store_memory);
 
 
-static ssize_t show_ordinals(struct device *d, char *buf)
+static ssize_t show_ordinals(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        u32 val = 0;
@@ -3786,7 +3821,8 @@ static ssize_t show_ordinals(struct device *d, char *buf)
 static DEVICE_ATTR(ordinals, S_IRUGO, show_ordinals, NULL);
 
 
-static ssize_t show_stats(struct device *d, char *buf)
+static ssize_t show_stats(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        char * out = buf;
@@ -3806,7 +3842,7 @@ static ssize_t show_stats(struct device *d, char *buf)
 static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL);
 
 
-int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
+static int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
 {
        int err;
 
@@ -3815,7 +3851,7 @@ int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
 
        err = ipw2100_disable_adapter(priv);
        if (err) {
-               IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
+               printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
                       priv->net_dev->name, err);
                return err;
        }
@@ -3851,7 +3887,8 @@ int ipw2100_switch_mode(struct ipw2100_priv *priv, u32 mode)
        return 0;
 }
 
-static ssize_t show_internals(struct device *d, char *buf)
+static ssize_t show_internals(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        int len = 0;
@@ -3902,7 +3939,8 @@ static ssize_t show_internals(struct device *d, char *buf)
 static DEVICE_ATTR(internals, S_IRUGO, show_internals, NULL);
 
 
-static ssize_t show_bssinfo(struct device *d, char *buf)
+static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        char essid[IW_ESSID_MAX_SIZE + 1];
@@ -3945,8 +3983,6 @@ static ssize_t show_bssinfo(struct device *d, char *buf)
 static DEVICE_ATTR(bssinfo, S_IRUGO, show_bssinfo, NULL);
 
 
-
-
 #ifdef CONFIG_IPW_DEBUG
 static ssize_t show_debug_level(struct device_driver *d, char *buf)
 {
@@ -3979,7 +4015,8 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, show_debug_level,
 #endif /* CONFIG_IPW_DEBUG */
 
 
-static ssize_t show_fatal_error(struct device *d, char *buf)
+static ssize_t show_fatal_error(struct device *d,
+                       struct device_attribute *attr, char *buf)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        char *out = buf;
@@ -4004,8 +4041,8 @@ static ssize_t show_fatal_error(struct device *d, char *buf)
        return out - buf;
 }
 
-static ssize_t store_fatal_error(struct device *d, const char *buf,
-                                size_t count)
+static ssize_t store_fatal_error(struct device *d,
+               struct device_attribute *attr, const char *buf, size_t count)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        schedule_reset(priv);
@@ -4014,13 +4051,15 @@ static ssize_t store_fatal_error(struct device *d, const char *buf,
 static DEVICE_ATTR(fatal_error, S_IWUSR|S_IRUGO, show_fatal_error, store_fatal_error);
 
 
-static ssize_t show_scan_age(struct device *d, char *buf)
+static ssize_t show_scan_age(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        return sprintf(buf, "%d\n", priv->ieee->scan_age);
 }
 
-static ssize_t store_scan_age(struct device *d, const char *buf, size_t count)
+static ssize_t store_scan_age(struct device *d, struct device_attribute *attr,
+                               const char *buf, size_t count)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        struct net_device *dev = priv->net_dev;
@@ -4056,7 +4095,8 @@ static ssize_t store_scan_age(struct device *d, const char *buf, size_t count)
 static DEVICE_ATTR(scan_age, S_IWUSR | S_IRUGO, show_scan_age, store_scan_age);
 
 
-static ssize_t show_rf_kill(struct device *d, char *buf)
+static ssize_t show_rf_kill(struct device *d, struct device_attribute *attr,
+                               char *buf)
 {
        /* 0 - RF kill not enabled
           1 - SW based RF kill active (sysfs)
@@ -4100,7 +4140,8 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio)
        return 1;
 }
 
-static ssize_t store_rf_kill(struct device *d, const char *buf, size_t count)
+static ssize_t store_rf_kill(struct device *d, struct device_attribute *attr,
+                               const char *buf, size_t count)
 {
        struct ipw2100_priv *priv = dev_get_drvdata(d);
        ipw_radio_kill_sw(priv, buf[0] == '1');
@@ -4212,7 +4253,7 @@ static void bd_queue_initialize(
 {
        IPW_DEBUG_INFO("enter\n");
 
-       IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, q->nic);
+       IPW_DEBUG_INFO("initializing bd queue at virt=%p, phys=%08x\n", q->drv, (u32)q->nic);
 
        write_register(priv->net_dev, base, q->nic);
        write_register(priv->net_dev, size, q->entries);
@@ -4256,7 +4297,7 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
                TX_PENDED_QUEUE_LENGTH * sizeof(struct ipw2100_tx_packet),
                GFP_ATOMIC);
        if (!priv->tx_buffers) {
-               IPW_DEBUG_ERROR("%s: alloc failed form tx buffers.\n",
+               printk(KERN_ERR DRV_NAME ": %s: alloc failed form tx buffers.\n",
                       priv->net_dev->name);
                bd_queue_free(priv, &priv->tx_queue);
                return -ENOMEM;
@@ -4266,7 +4307,7 @@ static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
                v = pci_alloc_consistent(
                        priv->pci_dev, sizeof(struct ipw2100_data_header), &p);
                if (!v) {
-                       IPW_DEBUG_ERROR("%s: PCI alloc failed for tx "
+                       printk(KERN_ERR DRV_NAME ": %s: PCI alloc failed for tx "
                               "buffers.\n", priv->net_dev->name);
                        err = -ENOMEM;
                        break;
@@ -4525,7 +4566,7 @@ static int ipw2100_read_mac_address(struct ipw2100_priv *priv)
  *
  ********************************************************************/
 
-int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode)
+static int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode)
 {
        struct host_command cmd = {
                .host_command = ADAPTER_ADDRESS,
@@ -4552,7 +4593,7 @@ int ipw2100_set_mac_address(struct ipw2100_priv *priv, int batch_mode)
        return err;
 }
 
-int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
+static int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
                                 int batch_mode)
 {
        struct host_command cmd = {
@@ -4577,7 +4618,7 @@ int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
        if (!batch_mode) {
                err = ipw2100_disable_adapter(priv);
                if (err) {
-                       IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
+                       printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
                               priv->net_dev->name, err);
                        return err;
                }
@@ -4593,7 +4634,8 @@ int ipw2100_set_port_type(struct ipw2100_priv *priv, u32 port_type,
 }
 
 
-int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, int batch_mode)
+static int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel,
+                              int batch_mode)
 {
        struct host_command cmd = {
                .host_command = CHANNEL,
@@ -4643,7 +4685,7 @@ int ipw2100_set_channel(struct ipw2100_priv *priv, u32 channel, int batch_mode)
        return 0;
 }
 
-int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
+static int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
 {
        struct host_command cmd = {
                .host_command = SYSTEM_CONFIG,
@@ -4705,7 +4747,8 @@ int ipw2100_system_config(struct ipw2100_priv *priv, int batch_mode)
        return 0;
 }
 
-int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, int batch_mode)
+static int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate,
+                               int batch_mode)
 {
        struct host_command cmd = {
                .host_command = BASIC_TX_RATES,
@@ -4744,8 +4787,8 @@ int ipw2100_set_tx_rates(struct ipw2100_priv *priv, u32 rate, int batch_mode)
        return 0;
 }
 
-int ipw2100_set_power_mode(struct ipw2100_priv *priv,
-                          int power_level)
+static int ipw2100_set_power_mode(struct ipw2100_priv *priv,
+                                 int power_level)
 {
        struct host_command cmd = {
                .host_command = POWER_MODE,
@@ -4782,7 +4825,7 @@ int ipw2100_set_power_mode(struct ipw2100_priv *priv,
 }
 
 
-int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold)
+static int ipw2100_set_rts_threshold(struct ipw2100_priv *priv, u32 threshold)
 {
        struct host_command cmd = {
                .host_command = RTS_THRESHOLD,
@@ -4846,7 +4889,7 @@ int ipw2100_set_fragmentation_threshold(struct ipw2100_priv *priv,
 }
 #endif
 
-int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry)
+static int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry)
 {
        struct host_command cmd = {
                .host_command = SHORT_RETRY_LIMIT,
@@ -4866,7 +4909,7 @@ int ipw2100_set_short_retry(struct ipw2100_priv *priv, u32 retry)
        return 0;
 }
 
-int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry)
+static int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry)
 {
        struct host_command cmd = {
                .host_command = LONG_RETRY_LIMIT,
@@ -4887,8 +4930,8 @@ int ipw2100_set_long_retry(struct ipw2100_priv *priv, u32 retry)
 }
 
 
-int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid,
-                               int batch_mode)
+static int ipw2100_set_mandatory_bssid(struct ipw2100_priv *priv, u8 *bssid,
+                                      int batch_mode)
 {
        struct host_command cmd = {
                .host_command = MANDATORY_BSSID,
@@ -5025,11 +5068,11 @@ struct security_info_params {
        u8 unicast_using_group;
 } __attribute__ ((packed));
 
-int ipw2100_set_security_information(struct ipw2100_priv *priv,
-                                    int auth_mode,
-                                    int security_level,
-                                    int unicast_using_group,
-                                    int batch_mode)
+static int ipw2100_set_security_information(struct ipw2100_priv *priv,
+                                           int auth_mode,
+                                           int security_level,
+                                           int unicast_using_group,
+                                           int batch_mode)
 {
        struct host_command cmd = {
                .host_command = SET_SECURITY_INFORMATION,
@@ -5091,8 +5134,8 @@ int ipw2100_set_security_information(struct ipw2100_priv *priv,
        return err;
 }
 
-int ipw2100_set_tx_power(struct ipw2100_priv *priv,
-                        u32 tx_power)
+static int ipw2100_set_tx_power(struct ipw2100_priv *priv,
+                               u32 tx_power)
 {
        struct host_command cmd = {
                .host_command = TX_POWER_INDEX,
@@ -5111,8 +5154,8 @@ int ipw2100_set_tx_power(struct ipw2100_priv *priv,
        return 0;
 }
 
-int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv,
-                                    u32 interval, int batch_mode)
+static int ipw2100_set_ibss_beacon_interval(struct ipw2100_priv *priv,
+                                           u32 interval, int batch_mode)
 {
        struct host_command cmd = {
                .host_command = BEACON_INTERVAL,
@@ -5196,7 +5239,7 @@ static int ipw2100_set_wep_flags(struct ipw2100_priv *priv, u32 flags,
        if (!batch_mode) {
                err = ipw2100_disable_adapter(priv);
                if (err) {
-                       IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
+                       printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
                               priv->net_dev->name, err);
                        return err;
                }
@@ -5284,7 +5327,7 @@ static int ipw2100_set_key(struct ipw2100_priv *priv,
                err = ipw2100_disable_adapter(priv);
                /* FIXME: IPG: shouldn't this prink be in _disable_adapter()? */
                if (err) {
-                       IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
+                       printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
                               priv->net_dev->name, err);
                        return err;
                }
@@ -5308,7 +5351,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv,
                .host_command = WEP_KEY_INDEX,
                .host_command_sequence = 0,
                .host_command_length = 4,
-               .host_command_parameters[0] = idx,
+               .host_command_parameters = { idx },
        };
        int err;
 
@@ -5320,7 +5363,7 @@ static int ipw2100_set_key_index(struct ipw2100_priv *priv,
        if (!batch_mode) {
                err = ipw2100_disable_adapter(priv);
                if (err) {
-                       IPW_DEBUG_ERROR("%s: Could not disable adapter %d\n",
+                       printk(KERN_ERR DRV_NAME ": %s: Could not disable adapter %d\n",
                               priv->net_dev->name, err);
                        return err;
                }
@@ -5642,8 +5685,10 @@ static int ipw2100_open(struct net_device *dev)
        IPW_DEBUG_INFO("dev->open\n");
 
        spin_lock_irqsave(&priv->low_lock, flags);
-       if (priv->status & STATUS_ASSOCIATED)
+       if (priv->status & STATUS_ASSOCIATED) {
+               netif_carrier_on(dev);
                netif_start_queue(dev);
+       }
        spin_unlock_irqrestore(&priv->low_lock, flags);
 
        return 0;
@@ -5868,7 +5913,7 @@ static int ipw2100_wpa_set_param(struct net_device *dev, u8 name, u32 value){
                        break;
 
                default:
-                       IPW_DEBUG_ERROR("%s: Unknown WPA param: %d\n",
+                       printk(KERN_ERR DRV_NAME ": %s: Unknown WPA param: %d\n",
                                            dev->name, name);
                        ret = -EOPNOTSUPP;
        }
@@ -5891,7 +5936,7 @@ static int ipw2100_wpa_mlme(struct net_device *dev, int command, int reason){
                        break;
 
                default:
-                       IPW_DEBUG_ERROR("%s: Unknown MLME request: %d\n",
+                       printk(KERN_ERR DRV_NAME ": %s: Unknown MLME request: %d\n",
                                            dev->name, command);
                        ret = -EOPNOTSUPP;
        }
@@ -6141,7 +6186,7 @@ static int ipw2100_wpa_supplicant(struct net_device *dev, struct iw_point *p){
                break;
 
        default:
-               IPW_DEBUG_ERROR("%s: Unknown WPA supplicant request: %d\n",
+               printk(KERN_ERR DRV_NAME ": %s: Unknown WPA supplicant request: %d\n",
                                dev->name, param->cmd);
                ret = -EOPNOTSUPP;
 
@@ -6282,7 +6327,7 @@ static void ipw2100_irq_tasklet(struct ipw2100_priv *priv);
 
 static struct net_device *ipw2100_alloc_device(
        struct pci_dev *pci_dev,
-       char *base_addr,
+       void __iomem *base_addr,
        unsigned long mem_start,
        unsigned long mem_len)
 {
@@ -6425,15 +6470,11 @@ static struct net_device *ipw2100_alloc_device(
        return dev;
 }
 
-
-
-#define PCI_DMA_32BIT   0x00000000ffffffffULL
-
 static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
                                const struct pci_device_id *ent)
 {
        unsigned long mem_start, mem_len, mem_flags;
-       char *base_addr = NULL;
+       void __iomem *base_addr = NULL;
        struct net_device *dev = NULL;
        struct ipw2100_priv *priv = NULL;
        int err = 0;
@@ -6482,7 +6523,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
        pci_set_master(pci_dev);
        pci_set_drvdata(pci_dev, priv);
 
-       err = pci_set_dma_mask(pci_dev, PCI_DMA_32BIT);
+       err = pci_set_dma_mask(pci_dev, DMA_32BIT_MASK);
        if (err) {
                printk(KERN_WARNING DRV_NAME
                       "Error calling pci_set_dma_mask.\n");
@@ -6504,7 +6545,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
        if ((val & 0x0000ff00) != 0)
                pci_write_config_dword(pci_dev, 0x40, val & 0xffff00ff);
 
-       pci_set_power_state(pci_dev, 0);
+       pci_set_power_state(pci_dev, PCI_D0);
 
        if (!ipw2100_hw_is_adapter_in_system(dev)) {
                printk(KERN_WARNING DRV_NAME
@@ -6623,7 +6664,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
        }
 
        if (base_addr)
-               iounmap((char*)base_addr);
+               iounmap(base_addr);
 
        pci_release_regions(pci_dev);
        pci_disable_device(pci_dev);
@@ -6673,7 +6714,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
                        free_irq(dev->irq, priv);
 
                if (dev->base_addr)
-                       iounmap((unsigned char *)dev->base_addr);
+                       iounmap((void __iomem *)dev->base_addr);
 
                free_ieee80211(dev);
        }
@@ -6707,17 +6748,9 @@ static int ipw2100_suspend(struct pci_dev *pci_dev, pm_message_t state)
        /* Remove the PRESENT state of the device */
        netif_device_detach(dev);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-       pci_save_state(pci_dev, priv->pm_state);
-#else
        pci_save_state(pci_dev);
-#endif
        pci_disable_device (pci_dev);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
-       pci_set_power_state(pci_dev, state);
-#else
        pci_set_power_state(pci_dev, PCI_D3hot);
-#endif
 
        up(&priv->action_sem);
 
@@ -6738,17 +6771,9 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
        IPW_DEBUG_INFO("%s: Coming out of suspend...\n",
               dev->name);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
-       pci_set_power_state(pci_dev, 0);
-#else
        pci_set_power_state(pci_dev, PCI_D0);
-#endif
        pci_enable_device(pci_dev);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
-       pci_restore_state(pci_dev, priv->pm_state);
-#else
        pci_restore_state(pci_dev);
-#endif
 
        /*
         * Suspend/Resume resets the PCI configuration space, so we have to
@@ -6891,7 +6916,7 @@ module_exit(ipw2100_exit);
 
 #define WEXT_USECHANNELS 1
 
-const long ipw2100_frequencies[] = {
+static const long ipw2100_frequencies[] = {
        2412, 2417, 2422, 2427,
        2432, 2437, 2442, 2447,
        2452, 2457, 2462, 2467,
@@ -6901,7 +6926,7 @@ const long ipw2100_frequencies[] = {
 #define FREQ_COUNT (sizeof(ipw2100_frequencies) / \
                     sizeof(ipw2100_frequencies[0]))
 
-const long ipw2100_rates_11b[] = {
+static const long ipw2100_rates_11b[] = {
        1000000,
        2000000,
        5500000,
@@ -7060,7 +7085,7 @@ static int ipw2100_wx_get_mode(struct net_device *dev,
 #define POWER_MODES 5
 
 /* Values are in microsecond */
-const s32 timeout_duration[POWER_MODES] = {
+static const s32 timeout_duration[POWER_MODES] = {
        350000,
        250000,
        75000,
@@ -7068,7 +7093,7 @@ const s32 timeout_duration[POWER_MODES] = {
        25000,
 };
 
-const s32 period_duration[POWER_MODES] = {
+static const s32 period_duration[POWER_MODES] = {
        400000,
        700000,
        1000000,
@@ -8056,7 +8081,7 @@ static iw_handler ipw2100_wx_handlers[] =
         ipw2100_wx_set_wap,       /* SIOCSIWAP */
         ipw2100_wx_get_wap,       /* SIOCGIWAP */
         NULL,                     /* -- hole -- */
-        NULL,                     /* SIOCGIWAPLIST -- depricated */
+        NULL,                     /* SIOCGIWAPLIST -- deprecated */
         ipw2100_wx_set_scan,      /* SIOCSIWSCAN */
         ipw2100_wx_get_scan,      /* SIOCGIWSCAN */
         ipw2100_wx_set_essid,     /* SIOCSIWESSID */
@@ -8133,7 +8158,7 @@ static iw_handler ipw2100_private_handler[] = {
        ipw2100_wx_get_preamble,
 };
 
-struct iw_handler_def ipw2100_wx_handler_def =
+static struct iw_handler_def ipw2100_wx_handler_def =
 {
        .standard = ipw2100_wx_handlers,
        .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler),
@@ -8149,7 +8174,7 @@ struct iw_handler_def ipw2100_wx_handler_def =
  * Called by /proc/net/wireless
  * Also called by SIOCGIWSTATS
  */
-struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
+static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
 {
        enum {
                POOR = 30,
@@ -8285,7 +8310,7 @@ struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device * dev)
        return (struct iw_statistics *) NULL;
 }
 
-void ipw2100_wx_event_work(struct ipw2100_priv *priv)
+static void ipw2100_wx_event_work(struct ipw2100_priv *priv)
 {
        union iwreq_data wrqu;
        int len = ETH_ALEN;
@@ -8383,7 +8408,7 @@ static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw)
                (struct ipw2100_fw_header *)fw->fw_entry->data;
 
        if (IPW2100_FW_MAJOR(h->version) != IPW2100_FW_MAJOR_VERSION) {
-               IPW_DEBUG_WARNING("Firmware image not compatible "
+               printk(KERN_WARNING DRV_NAME ": Firmware image not compatible "
                       "(detected version id of %u). "
                       "See Documentation/networking/README.ipw2100\n",
                       h->version);
@@ -8400,7 +8425,8 @@ static int ipw2100_mod_firmware_load(struct ipw2100_fw *fw)
 }
 
 
-int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
+static int ipw2100_get_firmware(struct ipw2100_priv *priv,
+                               struct ipw2100_fw *fw)
 {
        char *fw_name;
        int rc;
@@ -8426,12 +8452,12 @@ int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
        rc = request_firmware(&fw->fw_entry, fw_name, &priv->pci_dev->dev);
 
        if (rc < 0) {
-               IPW_DEBUG_ERROR(
+               printk(KERN_ERR DRV_NAME ": "
                       "%s: Firmware '%s' not available or load failed.\n",
                       priv->net_dev->name, fw_name);
                return rc;
        }
-       IPW_DEBUG_INFO("firmware data %p size %d\n", fw->fw_entry->data,
+       IPW_DEBUG_INFO("firmware data %p size %zd\n", fw->fw_entry->data,
                           fw->fw_entry->size);
 
        ipw2100_mod_firmware_load(fw);
@@ -8439,8 +8465,8 @@ int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
        return 0;
 }
 
-void ipw2100_release_firmware(struct ipw2100_priv *priv,
-                             struct ipw2100_fw *fw)
+static void ipw2100_release_firmware(struct ipw2100_priv *priv,
+                                    struct ipw2100_fw *fw)
 {
        fw->version = 0;
        if (fw->fw_entry)
@@ -8449,7 +8475,8 @@ void ipw2100_release_firmware(struct ipw2100_priv *priv,
 }
 
 
-int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, size_t max)
+static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf,
+                                size_t max)
 {
        char ver[MAX_FW_VERSION_LEN];
        u32 len = MAX_FW_VERSION_LEN;
@@ -8468,7 +8495,8 @@ int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, size_t max)
        return tmp;
 }
 
-int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, size_t max)
+static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf,
+                                   size_t max)
 {
        u32 ver;
        u32 len = sizeof(ver);
@@ -8482,7 +8510,8 @@ int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, size_t max)
 /*
  * On exit, the firmware will have been freed from the fw list
  */
-int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
+static int ipw2100_fw_download(struct ipw2100_priv *priv,
+                              struct ipw2100_fw *fw)
 {
        /* firmware is constructed of N contiguous entries, each entry is
         * structured as:
@@ -8508,7 +8537,7 @@ int ipw2100_fw_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
                firmware_data_left -= 2;
 
                if (len > 32) {
-                       IPW_DEBUG_ERROR(
+                       printk(KERN_ERR DRV_NAME ": "
                               "Invalid firmware run-length of %d bytes\n",
                               len);
                        return -EINVAL;
@@ -8539,11 +8568,13 @@ struct symbol_alive_response {
        u8 ucode_valid;
 };
 
-int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
+static int ipw2100_ucode_download(struct ipw2100_priv *priv,
+                                 struct ipw2100_fw *fw)
 {
        struct net_device *dev = priv->net_dev;
        const unsigned char *microcode_data = fw->uc.data;
        unsigned int microcode_data_left = fw->uc.size;
+       void __iomem *reg = (void __iomem *)dev->base_addr;
 
        struct symbol_alive_response response;
        int i, j;
@@ -8551,23 +8582,23 @@ int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
 
        /* Symbol control */
        write_nic_word(dev, IPW2100_CONTROL_REG, 0x703);
-       readl((void *)(dev->base_addr));
+       readl(reg);
        write_nic_word(dev, IPW2100_CONTROL_REG, 0x707);
-       readl((void *)(dev->base_addr));
+       readl(reg);
 
        /* HW config */
        write_nic_byte(dev, 0x210014, 0x72);    /* fifo width =16 */
-       readl((void *)(dev->base_addr));
+       readl(reg);
        write_nic_byte(dev, 0x210014, 0x72);    /* fifo width =16 */
-       readl((void *)(dev->base_addr));
+       readl(reg);
 
        /* EN_CS_ACCESS bit to reset control store pointer */
        write_nic_byte(dev, 0x210000, 0x40);
-       readl((void *)(dev->base_addr));
+       readl(reg);
        write_nic_byte(dev, 0x210000, 0x0);
-       readl((void *)(dev->base_addr));
+       readl(reg);
        write_nic_byte(dev, 0x210000, 0x40);
-       readl((void *)(dev->base_addr));
+       readl(reg);
 
        /* copy microcode from buffer into Symbol */
 
@@ -8579,31 +8610,31 @@ int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
 
        /* EN_CS_ACCESS bit to reset the control store pointer */
        write_nic_byte(dev, 0x210000, 0x0);
-       readl((void *)(dev->base_addr));
+       readl(reg);
 
        /* Enable System (Reg 0)
         * first enable causes garbage in RX FIFO */
        write_nic_byte(dev, 0x210000, 0x0);
-       readl((void *)(dev->base_addr));
+       readl(reg);
        write_nic_byte(dev, 0x210000, 0x80);
-       readl((void *)(dev->base_addr));
+       readl(reg);
 
        /* Reset External Baseband Reg */
        write_nic_word(dev, IPW2100_CONTROL_REG, 0x703);
-       readl((void *)(dev->base_addr));
+       readl(reg);
        write_nic_word(dev, IPW2100_CONTROL_REG, 0x707);
-       readl((void *)(dev->base_addr));
+       readl(reg);
 
        /* HW Config (Reg 5) */
        write_nic_byte(dev, 0x210014, 0x72);    // fifo width =16
-       readl((void *)(dev->base_addr));
+       readl(reg);
        write_nic_byte(dev, 0x210014, 0x72);    // fifo width =16
-       readl((void *)(dev->base_addr));
+       readl(reg);
 
        /* Enable System (Reg 0)
         * second enable should be OK */
        write_nic_byte(dev, 0x210000, 0x00);    // clear enable system
-       readl((void *)(dev->base_addr));
+       readl(reg);
        write_nic_byte(dev, 0x210000, 0x80);    // set enable system
 
        /* check Symbol is enabled - upped this from 5 as it wasn't always
@@ -8618,7 +8649,7 @@ int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
        }
 
        if (i == 10) {
-               IPW_DEBUG_ERROR("%s: Error initializing Symbol\n",
+               printk(KERN_ERR DRV_NAME ": %s: Error initializing Symbol\n",
                       dev->name);
                return -EIO;
        }
@@ -8639,7 +8670,7 @@ int ipw2100_ucode_download(struct ipw2100_priv *priv, struct ipw2100_fw *fw)
        }
 
        if (i == 30) {
-               IPW_DEBUG_ERROR("%s: No response from Symbol - hw not alive\n",
+               printk(KERN_ERR DRV_NAME ": %s: No response from Symbol - hw not alive\n",
                       dev->name);
                printk_buf(IPW_DL_ERROR, (u8*)&response, sizeof(response));
                return -EIO;