summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-io.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-04-13 03:14:43 -0700
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-04-22 10:02:19 -0700
commite46f6538c24f01bb68dc374358ce85a0af666682 (patch)
tree6d579e24d715096e9553557abcb1f90ffc7d8365 /drivers/net/wireless/iwlwifi/iwl-io.c
parent73b48099cc265f88fa1255f3f43e52fe6a94fd5c (diff)
iwlagn: simplify error table reading
The current code to read the error table header just hardcodes all the offsets, which is a bit hard to understand. We can read in the entire header (as much as we need) into a structure, and then take the data from there, which makes it easier to understand. To read a bigger blob we also don't need to grab NIC access for each word read, making the code more efficient. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-io.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c
index 51337416e4c..993b3df1b72 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.c
+++ b/drivers/net/wireless/iwlwifi/iwl-io.c
@@ -242,20 +242,32 @@ void iwl_clear_bits_prph(struct iwl_priv *priv, u32 reg, u32 mask)
spin_unlock_irqrestore(&priv->reg_lock, flags);
}
-u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr)
+void _iwl_read_targ_mem_words(struct iwl_priv *priv, u32 addr,
+ void *buf, int words)
{
unsigned long flags;
- u32 value;
+ int offs;
+ u32 *vals = buf;
spin_lock_irqsave(&priv->reg_lock, flags);
iwl_grab_nic_access(priv);
iwl_write32(priv, HBUS_TARG_MEM_RADDR, addr);
rmb();
- value = iwl_read32(priv, HBUS_TARG_MEM_RDAT);
+
+ for (offs = 0; offs < words; offs++)
+ vals[offs] = iwl_read32(priv, HBUS_TARG_MEM_RDAT);
iwl_release_nic_access(priv);
spin_unlock_irqrestore(&priv->reg_lock, flags);
+}
+
+u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr)
+{
+ u32 value;
+
+ _iwl_read_targ_mem_words(priv, addr, &value, 1);
+
return value;
}