iwlwifi: update copyright year to 2009
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-core.c
index 73d7973..d2ef3e1 100644 (file)
@@ -2,7 +2,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -170,7 +170,8 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
        struct ieee80211_hw *hw =
                ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops);
        if (hw == NULL) {
-               IWL_ERROR("Can not allocate network device\n");
+               printk(KERN_ERR "%s: Can not allocate network device\n",
+                      cfg->name);
                goto out;
        }
 
@@ -210,7 +211,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
        if (!rxq->bd) {
                ret = iwl_rx_queue_alloc(priv);
                if (ret) {
-                       IWL_ERROR("Unable to initialize Rx queue\n");
+                       IWL_ERR(priv, "Unable to initialize Rx queue\n");
                        return -ENOMEM;
                }
        } else
@@ -510,18 +511,16 @@ static int iwlcore_init_geos(struct iwl_priv *priv)
 
        if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
             priv->cfg->sku & IWL_SKU_A) {
-               printk(KERN_INFO DRV_NAME
-                      ": Incorrectly detected BG card as ABG.  Please send "
-                      "your PCI ID 0x%04X:0x%04X to maintainer.\n",
-                      priv->pci_dev->device, priv->pci_dev->subsystem_device);
+               IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
+                       "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
+                          priv->pci_dev->device,
+                          priv->pci_dev->subsystem_device);
                priv->cfg->sku &= ~IWL_SKU_A;
        }
 
-       printk(KERN_INFO DRV_NAME
-              ": Tunable channels: %d 802.11bg, %d 802.11a channels\n",
-              priv->bands[IEEE80211_BAND_2GHZ].n_channels,
-              priv->bands[IEEE80211_BAND_5GHZ].n_channels);
-
+       IWL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n",
+                  priv->bands[IEEE80211_BAND_2GHZ].n_channels,
+                  priv->bands[IEEE80211_BAND_5GHZ].n_channels);
 
        set_bit(STATUS_GEO_CONFIGURED, &priv->status);
 
@@ -679,7 +678,7 @@ static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
                break;
        case WLAN_HT_CAP_SM_PS_INVALID:
        default:
-               IWL_ERROR("invalid mimo ps mode %d\n",
+               IWL_ERR(priv, "invalid mimo ps mode %d\n",
                           priv->current_ht_config.sm_ps);
                WARN_ON(1);
                idle_cnt = -1;
@@ -806,7 +805,8 @@ int iwl_setup_mac(struct iwl_priv *priv)
        /* Tell mac80211 our characteristics */
        hw->flags = IEEE80211_HW_SIGNAL_DBM |
                    IEEE80211_HW_NOISE_DBM |
-                   IEEE80211_HW_AMPDU_AGGREGATION;
+                   IEEE80211_HW_AMPDU_AGGREGATION |
+                   IEEE80211_HW_SUPPORTS_PS;
        hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_ADHOC);
@@ -831,7 +831,7 @@ int iwl_setup_mac(struct iwl_priv *priv)
 
        ret = ieee80211_register_hw(priv->hw);
        if (ret) {
-               IWL_ERROR("Failed to register hw (error %d)\n", ret);
+               IWL_ERR(priv, "Failed to register hw (error %d)\n", ret);
                return ret;
        }
        priv->mac80211_registered = 1;
@@ -863,7 +863,6 @@ int iwl_init_drv(struct iwl_priv *priv)
 {
        int ret;
 
-       priv->retry_rate = 1;
        priv->ibss_beacon = NULL;
 
        spin_lock_init(&priv->lock);
@@ -903,13 +902,13 @@ int iwl_init_drv(struct iwl_priv *priv)
 
        ret = iwl_init_channel_map(priv);
        if (ret) {
-               IWL_ERROR("initializing regulatory failed: %d\n", ret);
+               IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
                goto err;
        }
 
        ret = iwlcore_init_geos(priv);
        if (ret) {
-               IWL_ERROR("initializing geos failed: %d\n", ret);
+               IWL_ERR(priv, "initializing geos failed: %d\n", ret);
                goto err_free_channel_map;
        }
 
@@ -926,13 +925,13 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
 {
        int ret = 0;
        if (tx_power < IWL_TX_POWER_TARGET_POWER_MIN) {
-               IWL_WARNING("Requested user TXPOWER %d below limit.\n",
+               IWL_WARN(priv, "Requested user TXPOWER %d below limit.\n",
                            priv->tx_power_user_lmt);
                return -EINVAL;
        }
 
        if (tx_power > IWL_TX_POWER_TARGET_POWER_MAX) {
-               IWL_WARNING("Requested user TXPOWER %d above limit.\n",
+               IWL_WARN(priv, "Requested user TXPOWER %d above limit.\n",
                            priv->tx_power_user_lmt);
                return -EINVAL;
        }
@@ -1018,7 +1017,7 @@ static int iwlcore_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32
                /* NOTE: Use the debugless read so we don't flood kernel log
                 * if IWL_DL_IO is set */
                iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR,
-                       i + RTC_INST_LOWER_BOUND);
+                       i + IWL49_RTC_INST_LOWER_BOUND);
                val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
                if (val != le32_to_cpu(*image)) {
                        ret = -EIO;
@@ -1051,7 +1050,8 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 *image,
        if (ret)
                return ret;
 
-       iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND);
+       iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR,
+                          IWL49_RTC_INST_LOWER_BOUND);
 
        errcnt = 0;
        for (; len > 0; len -= sizeof(u32), image++) {
@@ -1060,7 +1060,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 *image,
                 * if IWL_DL_IO is set */
                val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
                if (val != le32_to_cpu(*image)) {
-                       IWL_ERROR("uCode INST section is invalid at "
+                       IWL_ERR(priv, "uCode INST section is invalid at "
                                  "offset 0x%x, is 0x%x, s/b 0x%x\n",
                                  save_len - len, val, le32_to_cpu(*image));
                        ret = -EIO;
@@ -1116,7 +1116,7 @@ int iwl_verify_ucode(struct iwl_priv *priv)
                return 0;
        }
 
-       IWL_ERROR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
+       IWL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
 
        /* Since nothing seems to match, show first several data entries in
         * instruction SRAM, so maybe visual inspection will give a clue.
@@ -1188,21 +1188,22 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
                base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
 
        if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Not valid error log pointer 0x%08X\n", base);
+               IWL_ERR(priv, "Not valid error log pointer 0x%08X\n", base);
                return;
        }
 
        ret = iwl_grab_nic_access(priv);
        if (ret) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
+               IWL_WARN(priv, "Can not read from adapter at this time.\n");
                return;
        }
 
        count = iwl_read_targ_mem(priv, base);
 
        if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
-               IWL_ERROR("Start IWL Error Log Dump:\n");
-               IWL_ERROR("Status: 0x%08lX, count: %d\n", priv->status, count);
+               IWL_ERR(priv, "Start IWL Error Log Dump:\n");
+               IWL_ERR(priv, "Status: 0x%08lX, count: %d\n",
+                       priv->status, count);
        }
 
        desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32));
@@ -1215,12 +1216,12 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
        line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32));
        time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32));
 
-       IWL_ERROR("Desc                               Time       "
+       IWL_ERR(priv, "Desc                               Time       "
                "data1      data2      line\n");
-       IWL_ERROR("%-28s (#%02d) %010u 0x%08X 0x%08X %u\n",
+       IWL_ERR(priv, "%-28s (#%02d) %010u 0x%08X 0x%08X %u\n",
                desc_lookup(desc), desc, time, data1, data2, line);
-       IWL_ERROR("blink1  blink2  ilink1  ilink2\n");
-       IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2,
+       IWL_ERR(priv, "blink1  blink2  ilink1  ilink2\n");
+       IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2,
                ilink1, ilink2);
 
        iwl_release_nic_access(priv);
@@ -1266,11 +1267,11 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
                ptr += sizeof(u32);
                if (mode == 0) {
                        /* data, ev */
-                       IWL_ERROR("EVT_LOG:0x%08x:%04u\n", time, ev);
+                       IWL_ERR(priv, "EVT_LOG:0x%08x:%04u\n", time, ev);
                } else {
                        data = iwl_read_targ_mem(priv, ptr);
                        ptr += sizeof(u32);
-                       IWL_ERROR("EVT_LOGT:%010u:0x%08x:%04u\n",
+                       IWL_ERR(priv, "EVT_LOGT:%010u:0x%08x:%04u\n",
                                        time, data, ev);
                }
        }
@@ -1292,13 +1293,13 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv)
                base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
 
        if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
+               IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
                return;
        }
 
        ret = iwl_grab_nic_access(priv);
        if (ret) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
+               IWL_WARN(priv, "Can not read from adapter at this time.\n");
                return;
        }
 
@@ -1312,12 +1313,12 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv)
 
        /* bail out if nothing in log */
        if (size == 0) {
-               IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
+               IWL_ERR(priv, "Start IWL Event Log Dump: nothing in log\n");
                iwl_release_nic_access(priv);
                return;
        }
 
-       IWL_ERROR("Start IWL Event Log Dump: display count %d, wraps %d\n",
+       IWL_ERR(priv, "Start IWL Event Log Dump: display count %d, wraps %d\n",
                        size, num_wraps);
 
        /* if uCode has wrapped back to top of log, start at the oldest entry,
@@ -1349,7 +1350,7 @@ void iwl_rf_kill_ct_config(struct iwl_priv *priv)
        ret = iwl_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD,
                               sizeof(cmd), &cmd);
        if (ret)
-               IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n");
+               IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
        else
                IWL_DEBUG_INFO("REPLY_CT_KILL_CONFIG_CMD succeeded, "
                        "critical temperature is %d\n",
@@ -1368,7 +1369,7 @@ EXPORT_SYMBOL(iwl_rf_kill_ct_config);
  * When in the 'halt' state, the card is shut down and must be fully
  * restarted to come back on.
  */
-static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
+int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
 {
        struct iwl_host_cmd cmd = {
                .id = REPLY_CARD_STATE_CMD,
@@ -1379,6 +1380,7 @@ static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
 
        return iwl_send_cmd(priv, &cmd);
 }
+EXPORT_SYMBOL(iwl_send_card_state);
 
 void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv)
 {