iwlagn: debug_level moves to struct iwl_shared
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Fri, 26 Aug 2011 06:10:38 +0000 (23:10 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 29 Aug 2011 19:25:30 +0000 (15:25 -0400)
This will allow all the modules to look at it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-debug.h
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-shared.h
drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c

index 39e7bdbc9ff9144f352e2c1b230bf86013444b9b..637c5427e3d0066ed4d3c726636acad1bfee7834 100644 (file)
@@ -474,7 +474,7 @@ static ssize_t show_debug_level(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
        struct iwl_shared *shrd = dev_get_drvdata(d);
-       return sprintf(buf, "0x%08X\n", iwl_get_debug_level(shrd->priv));
+       return sprintf(buf, "0x%08X\n", iwl_get_debug_level(shrd));
 }
 static ssize_t store_debug_level(struct device *d,
                                struct device_attribute *attr,
@@ -489,9 +489,9 @@ static ssize_t store_debug_level(struct device *d,
        if (ret)
                IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);
        else {
-               priv->debug_level = val;
+               shrd->dbg_level_dev = val;
                if (iwl_alloc_traffic_mem(priv))
-                       IWL_ERR(priv,
+                       IWL_ERR(shrd->priv,
                                "Not enough memory to generate traffic log\n");
        }
        return strnlen(buf, count);
@@ -1621,7 +1621,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
        priv->bt_ch_announce = iwlagn_mod_params.bt_ch_announce;
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log)
+       if (!(iwl_get_debug_level(priv->shrd) & IWL_DL_FW_ERRORS) && !full_log)
                size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
                        ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
 #else
@@ -1641,7 +1641,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
                if (!*buf)
                        return -ENOMEM;
        }
-       if ((iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) {
+       if ((iwl_get_debug_level(priv->shrd) & IWL_DL_FW_ERRORS) || full_log) {
                /*
                 * if uCode has wrapped back to top of log,
                 * start at the oldest entry,
index 6c11f0dce0d1d4e44e039c8c38c6f935e646572e..2b3d0526e9659b80d541f000ab1f00f9d0db0f25 100644 (file)
@@ -931,7 +931,7 @@ void iwl_irq_handle_error(struct iwl_priv *priv)
        iwl_dump_fh(priv, NULL, false);
        iwl_dump_nic_event_log(priv, false, NULL, false);
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS)
+       if (iwl_get_debug_level(priv->shrd) & IWL_DL_FW_ERRORS)
                iwl_print_rx_config_cmd(priv,
                                        &priv->contexts[IWL_RXON_CTX_BSS]);
 #endif
@@ -1397,7 +1397,7 @@ int iwl_alloc_traffic_mem(struct iwl_priv *priv)
 {
        u32 traffic_size = IWL_TRAFFIC_DUMP_SIZE;
 
-       if (iwl_get_debug_level(priv) & IWL_DL_TX) {
+       if (iwl_get_debug_level(priv->shrd) & IWL_DL_TX) {
                if (!priv->tx_traffic) {
                        priv->tx_traffic =
                                kzalloc(traffic_size, GFP_KERNEL);
@@ -1405,7 +1405,7 @@ int iwl_alloc_traffic_mem(struct iwl_priv *priv)
                                return -ENOMEM;
                }
        }
-       if (iwl_get_debug_level(priv) & IWL_DL_RX) {
+       if (iwl_get_debug_level(priv->shrd) & IWL_DL_RX) {
                if (!priv->rx_traffic) {
                        priv->rx_traffic =
                                kzalloc(traffic_size, GFP_KERNEL);
@@ -1432,7 +1432,7 @@ void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv,
        __le16 fc;
        u16 len;
 
-       if (likely(!(iwl_get_debug_level(priv) & IWL_DL_TX)))
+       if (likely(!(iwl_get_debug_level(priv->shrd) & IWL_DL_TX)))
                return;
 
        if (!priv->tx_traffic)
@@ -1456,7 +1456,7 @@ void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv,
        __le16 fc;
        u16 len;
 
-       if (likely(!(iwl_get_debug_level(priv) & IWL_DL_RX)))
+       if (likely(!(iwl_get_debug_level(priv->shrd) & IWL_DL_RX)))
                return;
 
        if (!priv->rx_traffic)
index 0869eaa1308edb6470e862bf353375cdb540f63f..225ae720c7d2fc91789b7fbd78152f3a63da7aed 100644 (file)
@@ -45,7 +45,7 @@ do {                                                                  \
 #ifdef CONFIG_IWLWIFI_DEBUG
 #define IWL_DEBUG(__priv, level, fmt, args...)                         \
 do {                                                                   \
-       if (iwl_get_debug_level(__priv) & (level))                                      \
+       if (iwl_get_debug_level(__priv->shrd) & (level))                \
                dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev),         \
                         "%c %s " fmt, in_interrupt() ? 'I' : 'U',      \
                        __func__ , ## args);                            \
@@ -53,7 +53,7 @@ do {                                                                  \
 
 #define IWL_DEBUG_LIMIT(__priv, level, fmt, args...)                   \
 do {                                                                   \
-       if ((iwl_get_debug_level(__priv) & (level)) && net_ratelimit())         \
+       if ((iwl_get_debug_level(__priv->shrd) & (level)) && net_ratelimit())\
                dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev),         \
                        "%c %s " fmt, in_interrupt() ? 'I' : 'U',       \
                         __func__ , ## args);                           \
@@ -61,7 +61,7 @@ do {                                                                  \
 
 #define iwl_print_hex_dump(priv, level, p, len)                        \
 do {                                                                   \
-       if (iwl_get_debug_level(priv) & level)                          \
+       if (iwl_get_debug_level(priv->shrd) & level)                    \
                print_hex_dump(KERN_DEBUG, "iwl data: ",                \
                               DUMP_PREFIX_OFFSET, 16, 1, p, len, 1);   \
 } while (0)
index 08fc2b2cc516b87d964f628308a42d9727cfcddc..c798c6805b66f79b715ea7cf554340e40b7fa04e 100644 (file)
@@ -915,7 +915,8 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
                                "q[%d]: read_ptr: %u, write_ptr: %u\n",
                                cnt, q->read_ptr, q->write_ptr);
        }
-       if (priv->tx_traffic && (iwl_get_debug_level(priv) & IWL_DL_TX)) {
+       if (priv->tx_traffic &&
+               (iwl_get_debug_level(priv->shrd) & IWL_DL_TX)) {
                ptr = priv->tx_traffic;
                pos += scnprintf(buf + pos, bufsz - pos,
                                "Tx Traffic idx: %u\n", priv->tx_traffic_idx);
@@ -938,7 +939,8 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
                        "read: %u, write: %u\n",
                         rxq->read, rxq->write);
 
-       if (priv->rx_traffic && (iwl_get_debug_level(priv) & IWL_DL_RX)) {
+       if (priv->rx_traffic &&
+               (iwl_get_debug_level(priv->shrd) & IWL_DL_RX)) {
                ptr = priv->rx_traffic;
                pos += scnprintf(buf + pos, bufsz - pos,
                                "Rx Traffic idx: %u\n", priv->rx_traffic_idx);
index 85295b0201bf3de73bdd551b5a4f09772f6da982..e01caf7a1f12af31bd3a6bfb5d5c055ff070b2de 100644 (file)
@@ -1514,12 +1514,6 @@ struct iwl_priv {
        s8 tx_power_lmt_in_half_dbm; /* max tx power in half-dBm format */
        s8 tx_power_next;
 
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-       /* debugging info */
-       u32 debug_level; /* per device debugging will override global
-                           iwlagn_mod_params.debug_level if set */
-#endif /* CONFIG_IWLWIFI_DEBUG */
 #ifdef CONFIG_IWLWIFI_DEBUGFS
        /* debugfs */
        u16 tx_traffic_idx;
@@ -1569,29 +1563,6 @@ static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id)
 
 extern struct iwl_mod_params iwlagn_mod_params;
 
-#ifdef CONFIG_IWLWIFI_DEBUG
-/*
- * iwl_get_debug_level: Return active debug level for device
- *
- * Using sysfs it is possible to set per device debug level. This debug
- * level will be used if set, otherwise the global debug level which can be
- * set via module parameter is used.
- */
-static inline u32 iwl_get_debug_level(struct iwl_priv *priv)
-{
-       if (priv->debug_level)
-               return priv->debug_level;
-       else
-               return iwlagn_mod_params.debug_level;
-}
-#else
-static inline u32 iwl_get_debug_level(struct iwl_priv *priv)
-{
-       return iwlagn_mod_params.debug_level;
-}
-#endif
-
-
 static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv,
                                                         int txq_id, int idx)
 {
index 32744a72a6ac09c1b0bbe7f12186601842fccded..a7c0315472e99e9dc985dd1ee58f2a9e01dc19dc 100644 (file)
@@ -93,10 +93,16 @@ struct iwl_mod_params {
 /**
  * struct iwl_shared - shared fields for all the layers of the driver
  *
+ * @dbg_level_dev: dbg level set per device. Prevails on
+ *     iwlagn_mod_params.debug_level if set (!= 0)
  * @bus: pointer to the bus layer data
  * @priv: pointer to the upper layer data
  */
 struct iwl_shared {
+#ifdef CONFIG_IWLWIFI_DEBUG
+       u32 dbg_level_dev;
+#endif /* CONFIG_IWLWIFI_DEBUG */
+
        struct iwl_bus *bus;
        struct iwl_priv *priv;
 };
@@ -105,6 +111,28 @@ struct iwl_shared {
 #define priv(_m)       ((_m)->shrd->priv)
 #define bus(_m)                ((_m)->shrd->bus)
 
+#ifdef CONFIG_IWLWIFI_DEBUG
+/*
+ * iwl_get_debug_level: Return active debug level for device
+ *
+ * Using sysfs it is possible to set per device debug level. This debug
+ * level will be used if set, otherwise the global debug level which can be
+ * set via module parameter is used.
+ */
+static inline u32 iwl_get_debug_level(struct iwl_shared *shrd)
+{
+       if (shrd->dbg_level_dev)
+               return shrd->dbg_level_dev;
+       else
+               return iwlagn_mod_params.debug_level;
+}
+#else
+static inline u32 iwl_get_debug_level(struct iwl_shared *shrd)
+{
+       return iwlagn_mod_params.debug_level;
+}
+#endif
+
 #ifdef CONFIG_PM
 int iwl_suspend(struct iwl_priv *priv);
 int iwl_resume(struct iwl_priv *priv);
index 474860290404d2805657562c5f56dcc9629aca16..846db8fdbf6c4127531f4cd3d00c81bda6dd2919 100644 (file)
@@ -515,7 +515,7 @@ void iwl_irq_tasklet(struct iwl_priv *priv)
        inta = priv->inta;
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (iwl_get_debug_level(priv) & IWL_DL_ISR) {
+       if (iwl_get_debug_level(priv->shrd) & IWL_DL_ISR) {
                /* just for debug */
                inta_mask = iwl_read32(priv, CSR_INT_MASK);
                IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x\n ",
@@ -544,7 +544,7 @@ void iwl_irq_tasklet(struct iwl_priv *priv)
        }
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) {
+       if (iwl_get_debug_level(priv->shrd) & (IWL_DL_ISR)) {
                /* NIC fires this, but we don't use it, redundant with WAKEUP */
                if (inta & CSR_INT_BIT_SCD) {
                        IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
@@ -845,7 +845,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
        }
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (iwl_get_debug_level(priv) & (IWL_DL_ISR)) {
+       if (iwl_get_debug_level(priv->shrd) & (IWL_DL_ISR)) {
                inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
                IWL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, "
                              "fh 0x%08x\n", inta, inta_mask, inta_fh);