diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-05-29 16:47:30 +0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-06-06 15:21:52 +0400 |
commit | 2baa2e57a9add3f6e5add31f28404ca7b8efecb4 (patch) | |
tree | 7521e3731a1fc3fe17219a3242f0a09d48c2fe38 /drivers/net/wireless/iwlwifi/iwl-io.c | |
parent | 59c647b6266506cbbceadfabfd01168148f026c5 (diff) | |
download | linux-2baa2e57a9add3f6e5add31f28404ca7b8efecb4.tar.xz |
iwlwifi: add iwl_set_bits_mask
In a few cases we need to set a value in
a certain mask inside a register, add the
function iwl_set_bits_mask() to make such
code easy.
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-io.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-io.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c index ee93274214d6..5f2df70b73c1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/iwlwifi/iwl-io.c @@ -65,6 +65,24 @@ void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask) } EXPORT_SYMBOL_GPL(iwl_clear_bit); +void iwl_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value) +{ + unsigned long flags; + u32 v; + +#ifdef CONFIG_IWLWIFI_DEBUG + WARN_ON_ONCE(value & ~mask); +#endif + + spin_lock_irqsave(&trans->reg_lock, flags); + v = iwl_read32(trans, reg); + v &= ~mask; + v |= value; + iwl_write32(trans, reg, v); + spin_unlock_irqrestore(&trans->reg_lock, flags); +} +EXPORT_SYMBOL_GPL(iwl_set_bits_mask); + int iwl_poll_bit(struct iwl_trans *trans, u32 addr, u32 bits, u32 mask, int timeout) { |