aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c70
1 files changed, 28 insertions, 42 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 4a22d3fba75b..b775d5bab668 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -29,7 +29,6 @@
29 29
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/version.h>
33#include <linux/init.h> 32#include <linux/init.h>
34#include <linux/pci.h> 33#include <linux/pci.h>
35#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
@@ -275,10 +274,8 @@ static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv,
275 return 0; 274 return 0;
276 275
277 error: 276 error:
278 if (txq->txb) { 277 kfree(txq->txb);
279 kfree(txq->txb); 278 txq->txb = NULL;
280 txq->txb = NULL;
281 }
282 279
283 return -ENOMEM; 280 return -ENOMEM;
284} 281}
@@ -365,10 +362,8 @@ void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *t
365 txq->q.n_bd, txq->bd, txq->q.dma_addr); 362 txq->q.n_bd, txq->bd, txq->q.dma_addr);
366 363
367 /* De-alloc array of per-TFD driver data */ 364 /* De-alloc array of per-TFD driver data */
368 if (txq->txb) { 365 kfree(txq->txb);
369 kfree(txq->txb); 366 txq->txb = NULL;
370 txq->txb = NULL;
371 }
372 367
373 /* 0-fill queue descriptor structure */ 368 /* 0-fill queue descriptor structure */
374 memset(txq, 0, sizeof(*txq)); 369 memset(txq, 0, sizeof(*txq));
@@ -1562,7 +1557,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1562 BUILD_BUG_ON(sizeof(priv->eeprom) != IWL_EEPROM_IMAGE_SIZE); 1557 BUILD_BUG_ON(sizeof(priv->eeprom) != IWL_EEPROM_IMAGE_SIZE);
1563 1558
1564 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { 1559 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) {
1565 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x", gp); 1560 IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
1566 return -ENOENT; 1561 return -ENOENT;
1567 } 1562 }
1568 1563
@@ -1587,7 +1582,7 @@ int iwl3945_eeprom_init(struct iwl3945_priv *priv)
1587 } 1582 }
1588 1583
1589 if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) { 1584 if (!(r & CSR_EEPROM_REG_READ_VALID_MSK)) {
1590 IWL_ERROR("Time out reading EEPROM[%d]", addr); 1585 IWL_ERROR("Time out reading EEPROM[%d]\n", addr);
1591 return -ETIMEDOUT; 1586 return -ETIMEDOUT;
1592 } 1587 }
1593 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16)); 1588 e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
@@ -2511,7 +2506,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
2511 return priv->hw_setting.bcast_sta_id; 2506 return priv->hw_setting.bcast_sta_id;
2512 2507
2513 default: 2508 default:
2514 IWL_WARNING("Unknown mode of operation: %d", priv->iw_mode); 2509 IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
2515 return priv->hw_setting.bcast_sta_id; 2510 return priv->hw_setting.bcast_sta_id;
2516 } 2511 }
2517} 2512}
@@ -2667,7 +2662,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2667 * first entry */ 2662 * first entry */
2668 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 2663 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
2669 2664
2670 if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) 2665 if (info->control.hw_key)
2671 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0); 2666 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0);
2672 2667
2673 /* Set up TFD's 2nd entry to point directly to remainder of skb, 2668 /* Set up TFD's 2nd entry to point directly to remainder of skb,
@@ -2703,9 +2698,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2703 2698
2704 if (!ieee80211_has_morefrags(hdr->frame_control)) { 2699 if (!ieee80211_has_morefrags(hdr->frame_control)) {
2705 txq->need_update = 1; 2700 txq->need_update = 1;
2706 if (qc) { 2701 if (qc)
2707 priv->stations[sta_id].tid[tid].seq_number = seq_number; 2702 priv->stations[sta_id].tid[tid].seq_number = seq_number;
2708 }
2709 } else { 2703 } else {
2710 wait_write_ptr = 1; 2704 wait_write_ptr = 1;
2711 txq->need_update = 0; 2705 txq->need_update = 0;
@@ -3813,7 +3807,7 @@ int iwl3945_calc_db_from_ratio(int sig_ratio)
3813 /* 100:1 or higher, divide by 10 and use table, 3807 /* 100:1 or higher, divide by 10 and use table,
3814 * add 20 dB to make up for divide by 10 */ 3808 * add 20 dB to make up for divide by 10 */
3815 if (sig_ratio >= 100) 3809 if (sig_ratio >= 100)
3816 return (20 + (int)ratio2dB[sig_ratio/10]); 3810 return 20 + (int)ratio2dB[sig_ratio/10];
3817 3811
3818 /* We shouldn't see this */ 3812 /* We shouldn't see this */
3819 if (sig_ratio < 1) 3813 if (sig_ratio < 1)
@@ -5088,7 +5082,7 @@ static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv)
5088 * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host, 5082 * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host,
5089 * looking at all data. 5083 * looking at all data.
5090 */ 5084 */
5091static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 * image, u32 len) 5085static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 *image, u32 len)
5092{ 5086{
5093 u32 val; 5087 u32 val;
5094 u32 save_len = len; 5088 u32 save_len = len;
@@ -5237,7 +5231,7 @@ static int iwl3945_verify_bsm(struct iwl3945_priv *priv)
5237 val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG); 5231 val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG);
5238 for (reg = BSM_SRAM_LOWER_BOUND; 5232 for (reg = BSM_SRAM_LOWER_BOUND;
5239 reg < BSM_SRAM_LOWER_BOUND + len; 5233 reg < BSM_SRAM_LOWER_BOUND + len;
5240 reg += sizeof(u32), image ++) { 5234 reg += sizeof(u32), image++) {
5241 val = iwl3945_read_prph(priv, reg); 5235 val = iwl3945_read_prph(priv, reg);
5242 if (val != le32_to_cpu(*image)) { 5236 if (val != le32_to_cpu(*image)) {
5243 IWL_ERROR("BSM uCode verification failed at " 5237 IWL_ERROR("BSM uCode verification failed at "
@@ -6336,7 +6330,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data)
6336 DECLARE_MAC_BUF(mac); 6330 DECLARE_MAC_BUF(mac);
6337 6331
6338 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { 6332 if (priv->iw_mode == IEEE80211_IF_TYPE_AP) {
6339 IWL_ERROR("%s Should not be called in AP mode\n", __FUNCTION__); 6333 IWL_ERROR("%s Should not be called in AP mode\n", __func__);
6340 return; 6334 return;
6341 } 6335 }
6342 6336
@@ -6417,7 +6411,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data)
6417 6411
6418 default: 6412 default:
6419 IWL_ERROR("%s Should not be called in %d mode\n", 6413 IWL_ERROR("%s Should not be called in %d mode\n",
6420 __FUNCTION__, priv->iw_mode); 6414 __func__, priv->iw_mode);
6421 break; 6415 break;
6422 } 6416 }
6423 6417
@@ -6594,12 +6588,6 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
6594 6588
6595 IWL_DEBUG_MAC80211("enter\n"); 6589 IWL_DEBUG_MAC80211("enter\n");
6596 6590
6597 if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) {
6598 IWL_DEBUG_MAC80211("leave - monitor\n");
6599 dev_kfree_skb_any(skb);
6600 return 0;
6601 }
6602
6603 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len, 6591 IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
6604 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate); 6592 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
6605 6593
@@ -7456,7 +7444,7 @@ static ssize_t show_measurement(struct device *d,
7456 struct iwl3945_priv *priv = dev_get_drvdata(d); 7444 struct iwl3945_priv *priv = dev_get_drvdata(d);
7457 struct iwl3945_spectrum_notification measure_report; 7445 struct iwl3945_spectrum_notification measure_report;
7458 u32 size = sizeof(measure_report), len = 0, ofs = 0; 7446 u32 size = sizeof(measure_report), len = 0, ofs = 0;
7459 u8 *data = (u8 *) & measure_report; 7447 u8 *data = (u8 *)&measure_report;
7460 unsigned long flags; 7448 unsigned long flags;
7461 7449
7462 spin_lock_irqsave(&priv->lock, flags); 7450 spin_lock_irqsave(&priv->lock, flags);
@@ -7627,7 +7615,7 @@ static ssize_t show_power_level(struct device *d,
7627 else 7615 else
7628 p += sprintf(p, " \n"); 7616 p += sprintf(p, " \n");
7629 7617
7630 return (p - buf + 1); 7618 return p - buf + 1;
7631 7619
7632} 7620}
7633 7621
@@ -7649,7 +7637,7 @@ static ssize_t show_statistics(struct device *d,
7649 struct iwl3945_priv *priv = dev_get_drvdata(d); 7637 struct iwl3945_priv *priv = dev_get_drvdata(d);
7650 u32 size = sizeof(struct iwl3945_notif_statistics); 7638 u32 size = sizeof(struct iwl3945_notif_statistics);
7651 u32 len = 0, ofs = 0; 7639 u32 len = 0, ofs = 0;
7652 u8 *data = (u8 *) & priv->statistics; 7640 u8 *data = (u8 *)&priv->statistics;
7653 int rc = 0; 7641 int rc = 0;
7654 7642
7655 if (!iwl3945_is_alive(priv)) 7643 if (!iwl3945_is_alive(priv))
@@ -7899,8 +7887,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7899 priv->ibss_beacon = NULL; 7887 priv->ibss_beacon = NULL;
7900 7888
7901 /* Tell mac80211 our characteristics */ 7889 /* Tell mac80211 our characteristics */
7902 hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | 7890 hw->flags = IEEE80211_HW_SIGNAL_DBM |
7903 IEEE80211_HW_SIGNAL_DBM |
7904 IEEE80211_HW_NOISE_DBM; 7891 IEEE80211_HW_NOISE_DBM;
7905 7892
7906 /* 4 EDCA QOS priorities */ 7893 /* 4 EDCA QOS priorities */
@@ -8004,16 +7991,16 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
8004 7991
8005 /* nic init */ 7992 /* nic init */
8006 iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS, 7993 iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS,
8007 CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER); 7994 CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
8008 7995
8009 iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE); 7996 iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
8010 err = iwl3945_poll_bit(priv, CSR_GP_CNTRL, 7997 err = iwl3945_poll_bit(priv, CSR_GP_CNTRL,
8011 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 7998 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY,
8012 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000); 7999 CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
8013 if (err < 0) { 8000 if (err < 0) {
8014 IWL_DEBUG_INFO("Failed to init the card\n"); 8001 IWL_DEBUG_INFO("Failed to init the card\n");
8015 goto out_remove_sysfs; 8002 goto out_remove_sysfs;
8016 } 8003 }
8017 /* Read the EEPROM */ 8004 /* Read the EEPROM */
8018 err = iwl3945_eeprom_init(priv); 8005 err = iwl3945_eeprom_init(priv);
8019 if (err) { 8006 if (err) {
@@ -8115,9 +8102,8 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
8115 iwl3945_unset_hw_setting(priv); 8102 iwl3945_unset_hw_setting(priv);
8116 iwl3945_clear_stations_table(priv); 8103 iwl3945_clear_stations_table(priv);
8117 8104
8118 if (priv->mac80211_registered) { 8105 if (priv->mac80211_registered)
8119 ieee80211_unregister_hw(priv->hw); 8106 ieee80211_unregister_hw(priv->hw);
8120 }
8121 8107
8122 /*netif_stop_queue(dev); */ 8108 /*netif_stop_queue(dev); */
8123 flush_workqueue(priv->workqueue); 8109 flush_workqueue(priv->workqueue);