aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2008-12-18 21:37:08 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:58:55 -0500
commit40b8ec0bfa2d96c9feae2bc1596e9b427c77b8da (patch)
tree9c1bf8e43c1ace421cfe1c6e15c5db5cd573f987 /drivers/net/wireless/iwlwifi/iwl3945-base.c
parent3d24a9f790c0e39cfdef1446c7100e89c542805c (diff)
iwl3945: Getting rid of iwl-3945-debug.h
At the cost of adding a debug_level field to iwl3945_priv, we are now able to get rid of iwl-3945-debug.h, and use iwl-debug.h instead. Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com> Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c95
1 files changed, 41 insertions, 54 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 3d8669c6cc83..c706ccff159b 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -52,10 +52,6 @@
52#include "iwl-3945-fh.h" 52#include "iwl-3945-fh.h"
53#include "iwl-helpers.h" 53#include "iwl-helpers.h"
54 54
55#ifdef CONFIG_IWL3945_DEBUG
56u32 iwl3945_debug_level;
57#endif
58
59static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv, 55static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
60 struct iwl3945_tx_queue *txq); 56 struct iwl3945_tx_queue *txq);
61 57
@@ -2434,7 +2430,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
2434 IWL_DEBUG_DROP("Station %pM not in station map. " 2430 IWL_DEBUG_DROP("Station %pM not in station map. "
2435 "Defaulting to broadcast...\n", 2431 "Defaulting to broadcast...\n",
2436 hdr->addr1); 2432 hdr->addr1);
2437 iwl3945_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); 2433 iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
2438 return priv->hw_setting.bcast_sta_id; 2434 return priv->hw_setting.bcast_sta_id;
2439 } 2435 }
2440 /* If we are in monitor mode, use BCAST. This is required for 2436 /* If we are in monitor mode, use BCAST. This is required for
@@ -2640,10 +2636,10 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2640 txq->need_update = 0; 2636 txq->need_update = 0;
2641 } 2637 }
2642 2638
2643 iwl3945_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload, 2639 iwl_print_hex_dump(priv, IWL_DL_TX, out_cmd->cmd.payload,
2644 sizeof(out_cmd->cmd.tx)); 2640 sizeof(out_cmd->cmd.tx));
2645 2641
2646 iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, 2642 iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr,
2647 ieee80211_hdrlen(fc)); 2643 ieee80211_hdrlen(fc));
2648 2644
2649 /* Tell device the write index *just past* this latest filled TFD */ 2645 /* Tell device the write index *just past* this latest filled TFD */
@@ -3050,7 +3046,8 @@ static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv,
3050 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " 3046 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
3051 "notification for %s:\n", 3047 "notification for %s:\n",
3052 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); 3048 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
3053 iwl3945_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len)); 3049 iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw,
3050 le32_to_cpu(pkt->len));
3054} 3051}
3055 3052
3056static void iwl3945_bg_beacon_update(struct work_struct *work) 3053static void iwl3945_bg_beacon_update(struct work_struct *work)
@@ -3850,13 +3847,13 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
3850 * handle those that need handling via function in 3847 * handle those that need handling via function in
3851 * rx_handlers table. See iwl3945_setup_rx_handlers() */ 3848 * rx_handlers table. See iwl3945_setup_rx_handlers() */
3852 if (priv->rx_handlers[pkt->hdr.cmd]) { 3849 if (priv->rx_handlers[pkt->hdr.cmd]) {
3853 IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, 3850 IWL_DEBUG(IWL_DL_HCMD | IWL_DL_RX | IWL_DL_ISR,
3854 "r = %d, i = %d, %s, 0x%02x\n", r, i, 3851 "r = %d, i = %d, %s, 0x%02x\n", r, i,
3855 get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); 3852 get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
3856 priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); 3853 priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
3857 } else { 3854 } else {
3858 /* No handling needed */ 3855 /* No handling needed */
3859 IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR, 3856 IWL_DEBUG(IWL_DL_HCMD | IWL_DL_RX | IWL_DL_ISR,
3860 "r %d i %d No handler needed for %s, 0x%02x\n", 3857 "r %d i %d No handler needed for %s, 0x%02x\n",
3861 r, i, get_cmd_string(pkt->hdr.cmd), 3858 r, i, get_cmd_string(pkt->hdr.cmd),
3862 pkt->hdr.cmd); 3859 pkt->hdr.cmd);
@@ -3951,10 +3948,11 @@ static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
3951} 3948}
3952 3949
3953#ifdef CONFIG_IWL3945_DEBUG 3950#ifdef CONFIG_IWL3945_DEBUG
3954static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon) 3951static void iwl3945_print_rx_config_cmd(struct iwl3945_priv *priv,
3952 struct iwl3945_rxon_cmd *rxon)
3955{ 3953{
3956 IWL_DEBUG_RADIO("RX CONFIG:\n"); 3954 IWL_DEBUG_RADIO("RX CONFIG:\n");
3957 iwl3945_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon)); 3955 iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
3958 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel)); 3956 IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
3959 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags)); 3957 IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
3960 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n", 3958 IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
@@ -4188,10 +4186,10 @@ static void iwl3945_irq_handle_error(struct iwl3945_priv *priv)
4188 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 4186 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
4189 4187
4190#ifdef CONFIG_IWL3945_DEBUG 4188#ifdef CONFIG_IWL3945_DEBUG
4191 if (iwl3945_debug_level & IWL_DL_FW_ERRORS) { 4189 if (priv->debug_level & IWL_DL_FW_ERRORS) {
4192 iwl3945_dump_nic_error_log(priv); 4190 iwl3945_dump_nic_error_log(priv);
4193 iwl3945_dump_nic_event_log(priv); 4191 iwl3945_dump_nic_event_log(priv);
4194 iwl3945_print_rx_config_cmd(&priv->staging_rxon); 4192 iwl3945_print_rx_config_cmd(priv, &priv->staging_rxon);
4195 } 4193 }
4196#endif 4194#endif
4197 4195
@@ -4255,7 +4253,7 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
4255 iwl3945_write32(priv, CSR_FH_INT_STATUS, inta_fh); 4253 iwl3945_write32(priv, CSR_FH_INT_STATUS, inta_fh);
4256 4254
4257#ifdef CONFIG_IWL3945_DEBUG 4255#ifdef CONFIG_IWL3945_DEBUG
4258 if (iwl3945_debug_level & IWL_DL_ISR) { 4256 if (priv->debug_level & IWL_DL_ISR) {
4259 /* just for debug */ 4257 /* just for debug */
4260 inta_mask = iwl3945_read32(priv, CSR_INT_MASK); 4258 inta_mask = iwl3945_read32(priv, CSR_INT_MASK);
4261 IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 4259 IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
@@ -4289,7 +4287,7 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
4289 } 4287 }
4290 4288
4291#ifdef CONFIG_IWL3945_DEBUG 4289#ifdef CONFIG_IWL3945_DEBUG
4292 if (iwl3945_debug_level & (IWL_DL_ISR)) { 4290 if (priv->debug_level & (IWL_DL_ISR)) {
4293 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 4291 /* NIC fires this, but we don't use it, redundant with WAKEUP */
4294 if (inta & CSR_INT_BIT_SCD) 4292 if (inta & CSR_INT_BIT_SCD)
4295 IWL_DEBUG_ISR("Scheduler finished to transmit " 4293 IWL_DEBUG_ISR("Scheduler finished to transmit "
@@ -4360,7 +4358,7 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
4360 iwl3945_enable_interrupts(priv); 4358 iwl3945_enable_interrupts(priv);
4361 4359
4362#ifdef CONFIG_IWL3945_DEBUG 4360#ifdef CONFIG_IWL3945_DEBUG
4363 if (iwl3945_debug_level & (IWL_DL_ISR)) { 4361 if (priv->debug_level & (IWL_DL_ISR)) {
4364 inta = iwl3945_read32(priv, CSR_INT); 4362 inta = iwl3945_read32(priv, CSR_INT);
4365 inta_mask = iwl3945_read32(priv, CSR_INT_MASK); 4363 inta_mask = iwl3945_read32(priv, CSR_INT_MASK);
4366 inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS); 4364 inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
@@ -7143,9 +7141,6 @@ static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
7143static int iwl3945_mac_get_stats(struct ieee80211_hw *hw, 7141static int iwl3945_mac_get_stats(struct ieee80211_hw *hw,
7144 struct ieee80211_low_level_stats *stats) 7142 struct ieee80211_low_level_stats *stats)
7145{ 7143{
7146 IWL_DEBUG_MAC80211("enter\n");
7147 IWL_DEBUG_MAC80211("leave\n");
7148
7149 return 0; 7144 return 0;
7150} 7145}
7151 7146
@@ -7260,29 +7255,33 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
7260 * 7255 *
7261 * See the level definitions in iwl for details. 7256 * See the level definitions in iwl for details.
7262 */ 7257 */
7263 7258static ssize_t show_debug_level(struct device *d,
7264static ssize_t show_debug_level(struct device_driver *d, char *buf) 7259 struct device_attribute *attr, char *buf)
7265{ 7260{
7266 return sprintf(buf, "0x%08X\n", iwl3945_debug_level); 7261 struct iwl3945_priv *priv = d->driver_data;
7262
7263 return sprintf(buf, "0x%08X\n", priv->debug_level);
7267} 7264}
7268static ssize_t store_debug_level(struct device_driver *d, 7265static ssize_t store_debug_level(struct device *d,
7266 struct device_attribute *attr,
7269 const char *buf, size_t count) 7267 const char *buf, size_t count)
7270{ 7268{
7271 char *p = (char *)buf; 7269 struct iwl3945_priv *priv = d->driver_data;
7272 u32 val; 7270 unsigned long val;
7271 int ret;
7273 7272
7274 val = simple_strtoul(p, &p, 0); 7273 ret = strict_strtoul(buf, 0, &val);
7275 if (p == buf) 7274 if (ret)
7276 printk(KERN_INFO DRV_NAME 7275 printk(KERN_INFO DRV_NAME
7277 ": %s is not in hex or decimal form.\n", buf); 7276 ": %s is not in hex or decimal form.\n", buf);
7278 else 7277 else
7279 iwl3945_debug_level = val; 7278 priv->debug_level = val;
7280 7279
7281 return strnlen(buf, count); 7280 return strnlen(buf, count);
7282} 7281}
7283 7282
7284static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, 7283static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
7285 show_debug_level, store_debug_level); 7284 show_debug_level, store_debug_level);
7286 7285
7287#endif /* CONFIG_IWL3945_DEBUG */ 7286#endif /* CONFIG_IWL3945_DEBUG */
7288 7287
@@ -7763,7 +7762,9 @@ static struct attribute *iwl3945_sysfs_entries[] = {
7763 &dev_attr_status.attr, 7762 &dev_attr_status.attr,
7764 &dev_attr_temperature.attr, 7763 &dev_attr_temperature.attr,
7765 &dev_attr_tx_power.attr, 7764 &dev_attr_tx_power.attr,
7766 7765#ifdef CONFIG_IWL3945_DEBUG
7766 &dev_attr_debug_level.attr,
7767#endif
7767 NULL 7768 NULL
7768}; 7769};
7769 7770
@@ -7802,13 +7803,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7802 * 1. Allocating HW data 7803 * 1. Allocating HW data
7803 * ********************/ 7804 * ********************/
7804 7805
7805 /* Disabling hardware scan means that mac80211 will perform scans
7806 * "the hard way", rather than using device's scan. */
7807 if (iwl3945_param_disable_hw_scan) {
7808 IWL_DEBUG_INFO("Disabling hw_scan\n");
7809 iwl3945_hw_ops.hw_scan = NULL;
7810 }
7811
7812 if ((iwl3945_param_queues_num > IWL39_MAX_NUM_QUEUES) || 7806 if ((iwl3945_param_queues_num > IWL39_MAX_NUM_QUEUES) ||
7813 (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) { 7807 (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) {
7814 IWL_ERROR("invalid queues_num, should be between %d and %d\n", 7808 IWL_ERROR("invalid queues_num, should be between %d and %d\n",
@@ -7833,6 +7827,13 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7833 priv->pci_dev = pdev; 7827 priv->pci_dev = pdev;
7834 priv->cfg = cfg; 7828 priv->cfg = cfg;
7835 7829
7830 /* Disabling hardware scan means that mac80211 will perform scans
7831 * "the hard way", rather than using device's scan. */
7832 if (iwl3945_param_disable_hw_scan) {
7833 IWL_DEBUG_INFO("Disabling hw_scan\n");
7834 iwl3945_hw_ops.hw_scan = NULL;
7835 }
7836
7836 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n"); 7837 IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
7837 hw->rate_control_algorithm = "iwl-3945-rs"; 7838 hw->rate_control_algorithm = "iwl-3945-rs";
7838 hw->sta_data_size = sizeof(struct iwl3945_sta_priv); 7839 hw->sta_data_size = sizeof(struct iwl3945_sta_priv);
@@ -7840,7 +7841,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7840 /* Select antenna (may be helpful if only one antenna is connected) */ 7841 /* Select antenna (may be helpful if only one antenna is connected) */
7841 priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna; 7842 priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna;
7842#ifdef CONFIG_IWL3945_DEBUG 7843#ifdef CONFIG_IWL3945_DEBUG
7843 iwl3945_debug_level = iwl3945_param_debug; 7844 priv->debug_level = iwl3945_param_debug;
7844 atomic_set(&priv->restrict_refcnt, 0); 7845 atomic_set(&priv->restrict_refcnt, 0);
7845#endif 7846#endif
7846 7847
@@ -8301,20 +8302,9 @@ static int __init iwl3945_init(void)
8301 IWL_ERROR("Unable to initialize PCI module\n"); 8302 IWL_ERROR("Unable to initialize PCI module\n");
8302 goto error_register; 8303 goto error_register;
8303 } 8304 }
8304#ifdef CONFIG_IWL3945_DEBUG
8305 ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level);
8306 if (ret) {
8307 IWL_ERROR("Unable to create driver sysfs file\n");
8308 goto error_debug;
8309 }
8310#endif
8311 8305
8312 return ret; 8306 return ret;
8313 8307
8314#ifdef CONFIG_IWL3945_DEBUG
8315error_debug:
8316 pci_unregister_driver(&iwl3945_driver);
8317#endif
8318error_register: 8308error_register:
8319 iwl3945_rate_control_unregister(); 8309 iwl3945_rate_control_unregister();
8320 return ret; 8310 return ret;
@@ -8322,9 +8312,6 @@ error_register:
8322 8312
8323static void __exit iwl3945_exit(void) 8313static void __exit iwl3945_exit(void)
8324{ 8314{
8325#ifdef CONFIG_IWL3945_DEBUG
8326 driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level);
8327#endif
8328 pci_unregister_driver(&iwl3945_driver); 8315 pci_unregister_driver(&iwl3945_driver);
8329 iwl3945_rate_control_unregister(); 8316 iwl3945_rate_control_unregister();
8330} 8317}