diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2012-02-13 11:23:09 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-02-22 14:51:12 -0500 |
commit | 1e0f32a43ae652eaa5b23dc06852938555cb8da1 (patch) | |
tree | 374663ec03298f09ad53c1e513e7582da8c508ed /drivers/net/wireless/iwlegacy/common.c | |
parent | b6603036ad87244bd39ed7bc0612009df7694f5e (diff) |
iwlegacy: always check if got h/w access before write
Before we write to the device register always check if
_il_grap_nic_access() was successful.
Change type return type _il_grap_nic_access() to bool, and
add likely()/unlikely() statements.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy/common.c')
-rw-r--r-- | drivers/net/wireless/iwlegacy/common.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 3900967a79f6..6dbd11f76f84 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c @@ -81,7 +81,7 @@ il_clear_bit(struct il_priv *p, u32 r, u32 m) } EXPORT_SYMBOL(il_clear_bit); -int +bool _il_grab_nic_access(struct il_priv *il) { int ret; @@ -116,10 +116,10 @@ _il_grab_nic_access(struct il_priv *il) WARN_ONCE(1, "Timeout waiting for ucode processor access " "(CSR_GP_CNTRL 0x%08x)\n", val); _il_wr(il, CSR_RESET, CSR_RESET_REG_FLAG_FORCE_NMI); - return -EIO; + return false; } - return 0; + return true; } EXPORT_SYMBOL_GPL(_il_grab_nic_access); @@ -161,7 +161,7 @@ il_wr_prph(struct il_priv *il, u32 addr, u32 val) unsigned long reg_flags; spin_lock_irqsave(&il->reg_lock, reg_flags); - if (!_il_grab_nic_access(il)) { + if (likely(_il_grab_nic_access(il))) { _il_wr_prph(il, addr, val); _il_release_nic_access(il); } @@ -194,7 +194,7 @@ il_write_targ_mem(struct il_priv *il, u32 addr, u32 val) unsigned long reg_flags; spin_lock_irqsave(&il->reg_lock, reg_flags); - if (!_il_grab_nic_access(il)) { + if (likely(_il_grab_nic_access(il))) { _il_wr(il, HBUS_TARG_MEM_WADDR, addr); wmb(); _il_wr(il, HBUS_TARG_MEM_WDAT, val); |