Commit 51cd53ad authored by Johannes Berg's avatar Johannes Berg

iwlwifi: reduce debug ifdefs using the optimiser

Instead of using #ifdef CONFIG_IWLWIFI_DEBUG, remove the
iwlwifi_mod_params.debug_level variable completely and
make iwl_have_debug_level() always return false in the
non-debug case. This way, the optimiser will elide all
code for it automatically without having to add #ifdefs.
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 12dcf2c3
...@@ -1859,14 +1859,9 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log, ...@@ -1859,14 +1859,9 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
return pos; return pos;
} }
#ifdef CONFIG_IWLWIFI_DEBUG
if (!(iwl_have_debug_level(IWL_DL_FW_ERRORS)) && !full_log) if (!(iwl_have_debug_level(IWL_DL_FW_ERRORS)) && !full_log)
size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES) size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size; ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
#else
size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
#endif
IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n", IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n",
size); size);
...@@ -1910,10 +1905,8 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand) ...@@ -1910,10 +1905,8 @@ static void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
unsigned int reload_msec; unsigned int reload_msec;
unsigned long reload_jiffies; unsigned long reload_jiffies;
#ifdef CONFIG_IWLWIFI_DEBUG
if (iwl_have_debug_level(IWL_DL_FW_ERRORS)) if (iwl_have_debug_level(IWL_DL_FW_ERRORS))
iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS); iwl_print_rx_config_cmd(priv, IWL_RXON_CTX_BSS);
#endif
/* uCode is no longer loaded. */ /* uCode is no longer loaded. */
priv->ucode_loaded = false; priv->ucode_loaded = false;
......
...@@ -34,7 +34,11 @@ ...@@ -34,7 +34,11 @@
static inline bool iwl_have_debug_level(u32 level) static inline bool iwl_have_debug_level(u32 level)
{ {
#ifdef CONFIG_IWLWIFI_DEBUG
return iwlwifi_mod_params.debug_level & level; return iwlwifi_mod_params.debug_level & level;
#else
return false;
#endif
} }
void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace, void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace,
......
...@@ -115,7 +115,9 @@ struct iwl_mod_params { ...@@ -115,7 +115,9 @@ struct iwl_mod_params {
int led_mode; int led_mode;
bool power_save; bool power_save;
int power_level; int power_level;
#ifdef CONFIG_IWLWIFI_DEBUG
u32 debug_level; u32 debug_level;
#endif
int ant_coupling; int ant_coupling;
bool bt_ch_announce; bool bt_ch_announce;
bool auto_agg; bool auto_agg;
......
...@@ -802,9 +802,6 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) ...@@ -802,9 +802,6 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id)
u32 handled = 0; u32 handled = 0;
unsigned long flags; unsigned long flags;
u32 i; u32 i;
#ifdef CONFIG_IWLWIFI_DEBUG
u32 inta_mask;
#endif
lock_map_acquire(&trans->sync_cmd_lockdep_map); lock_map_acquire(&trans->sync_cmd_lockdep_map);
...@@ -826,14 +823,9 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) ...@@ -826,14 +823,9 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id)
inta = trans_pcie->inta; inta = trans_pcie->inta;
#ifdef CONFIG_IWLWIFI_DEBUG if (iwl_have_debug_level(IWL_DL_ISR))
if (iwl_have_debug_level(IWL_DL_ISR)) {
/* just for debug */
inta_mask = iwl_read32(trans, CSR_INT_MASK);
IWL_DEBUG_ISR(trans, "inta 0x%08x, enabled 0x%08x\n", IWL_DEBUG_ISR(trans, "inta 0x%08x, enabled 0x%08x\n",
inta, inta_mask); inta, iwl_read32(trans, CSR_INT_MASK));
}
#endif
/* saved interrupt in inta variable now we can reset trans_pcie->inta */ /* saved interrupt in inta variable now we can reset trans_pcie->inta */
trans_pcie->inta = 0; trans_pcie->inta = 0;
...@@ -855,12 +847,11 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) ...@@ -855,12 +847,11 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id)
goto out; goto out;
} }
#ifdef CONFIG_IWLWIFI_DEBUG
if (iwl_have_debug_level(IWL_DL_ISR)) { if (iwl_have_debug_level(IWL_DL_ISR)) {
/* NIC fires this, but we don't use it, redundant with WAKEUP */ /* NIC fires this, but we don't use it, redundant with WAKEUP */
if (inta & CSR_INT_BIT_SCD) { if (inta & CSR_INT_BIT_SCD) {
IWL_DEBUG_ISR(trans, "Scheduler finished to transmit " IWL_DEBUG_ISR(trans,
"the frame/frames.\n"); "Scheduler finished to transmit the frame/frames.\n");
isr_stats->sch++; isr_stats->sch++;
} }
...@@ -870,7 +861,7 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) ...@@ -870,7 +861,7 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id)
isr_stats->alive++; isr_stats->alive++;
} }
} }
#endif
/* Safely ignore these bits for debug checks below */ /* Safely ignore these bits for debug checks below */
inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE); inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE);
...@@ -1118,9 +1109,6 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data) ...@@ -1118,9 +1109,6 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
struct iwl_trans *trans = data; struct iwl_trans *trans = data;
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
u32 inta, inta_mask; u32 inta, inta_mask;
#ifdef CONFIG_IWLWIFI_DEBUG
u32 inta_fh;
#endif
lockdep_assert_held(&trans_pcie->irq_lock); lockdep_assert_held(&trans_pcie->irq_lock);
...@@ -1159,13 +1147,11 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data) ...@@ -1159,13 +1147,11 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
#ifdef CONFIG_IWLWIFI_DEBUG if (iwl_have_debug_level(IWL_DL_ISR))
if (iwl_have_debug_level(IWL_DL_ISR)) { IWL_DEBUG_ISR(trans,
inta_fh = iwl_read32(trans, CSR_FH_INT_STATUS); "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled 0x%08x, " inta, inta_mask,
"fh 0x%08x\n", inta, inta_mask, inta_fh); iwl_read32(trans, CSR_FH_INT_STATUS));
}
#endif
trans_pcie->inta |= inta; trans_pcie->inta |= inta;
/* the thread will service interrupts and re-enable them */ /* the thread will service interrupts and re-enable them */
...@@ -1272,11 +1258,9 @@ irqreturn_t iwl_pcie_isr_ict(int irq, void *data) ...@@ -1272,11 +1258,9 @@ irqreturn_t iwl_pcie_isr_ict(int irq, void *data)
inta = (0xff & val) | ((0xff00 & val) << 16); inta = (0xff & val) | ((0xff00 & val) << 16);
IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled(sw) 0x%08x ict 0x%08x\n", IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled(sw) 0x%08x ict 0x%08x\n",
inta, trans_pcie->inta_mask, val); inta, trans_pcie->inta_mask, val);
#ifdef CONFIG_IWLWIFI_DEBUG
if (iwl_have_debug_level(IWL_DL_ISR)) if (iwl_have_debug_level(IWL_DL_ISR))
IWL_DEBUG_ISR(trans, "enabled(hw) 0x%08x\n", IWL_DEBUG_ISR(trans, "enabled(hw) 0x%08x\n",
iwl_read32(trans, CSR_INT_MASK)); iwl_read32(trans, CSR_INT_MASK));
#endif
inta &= trans_pcie->inta_mask; inta &= trans_pcie->inta_mask;
trans_pcie->inta |= inta; trans_pcie->inta |= inta;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment