aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2012-02-13 05:23:10 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-22 14:51:12 -0500
commit4e5ea2088b699ae86ffd96b53b916a3966535fcb (patch)
tree33af73e283a223658d20ee475cae1bbe4d16862c /drivers/net/wireless/iwlegacy
parent1e0f32a43ae652eaa5b23dc06852938555cb8da1 (diff)
iwlegacy: cleanup/fix memory barriers
wmb(), rmb() are not needed when writel(), readl() are used as accessors for MMIO. We use them indirectly via iowrite32(), ioread32(). What is needed mmiowb(), for synchronizing writes coming from different CPUs on PCIe bridge (see in patch comments). This fortunately is not needed on x86, where mmiowb() is just defined as compiler barrier. As iwlegacy devices are most likely not used on anything other than x86, this is not so important fix. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy')
-rw-r--r--drivers/net/wireless/iwlegacy/common.c2
-rw-r--r--drivers/net/wireless/iwlegacy/common.h9
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 6dbd11f76f84..50308da8aee3 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -179,7 +179,6 @@ il_read_targ_mem(struct il_priv *il, u32 addr)
179 _il_grab_nic_access(il); 179 _il_grab_nic_access(il);
180 180
181 _il_wr(il, HBUS_TARG_MEM_RADDR, addr); 181 _il_wr(il, HBUS_TARG_MEM_RADDR, addr);
182 rmb();
183 value = _il_rd(il, HBUS_TARG_MEM_RDAT); 182 value = _il_rd(il, HBUS_TARG_MEM_RDAT);
184 183
185 _il_release_nic_access(il); 184 _il_release_nic_access(il);
@@ -196,7 +195,6 @@ il_write_targ_mem(struct il_priv *il, u32 addr, u32 val)
196 spin_lock_irqsave(&il->reg_lock, reg_flags); 195 spin_lock_irqsave(&il->reg_lock, reg_flags);
197 if (likely(_il_grab_nic_access(il))) { 196 if (likely(_il_grab_nic_access(il))) {
198 _il_wr(il, HBUS_TARG_MEM_WADDR, addr); 197 _il_wr(il, HBUS_TARG_MEM_WADDR, addr);
199 wmb();
200 _il_wr(il, HBUS_TARG_MEM_WDAT, val); 198 _il_wr(il, HBUS_TARG_MEM_WDAT, val);
201 _il_release_nic_access(il); 199 _il_release_nic_access(il);
202 } 200 }
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index 1dfaa58acc45..df9b5b462839 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -2146,6 +2146,13 @@ static inline void
2146_il_release_nic_access(struct il_priv *il) 2146_il_release_nic_access(struct il_priv *il)
2147{ 2147{
2148 _il_clear_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 2148 _il_clear_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
2149 /*
2150 * In above we are reading CSR_GP_CNTRL register, what will flush any
2151 * previous writes, but still want write, which clear MAC_ACCESS_REQ
2152 * bit, be performed on PCI bus before any other writes scheduled on
2153 * different CPUs (after we drop reg_lock).
2154 */
2155 mmiowb();
2149} 2156}
2150 2157
2151static inline u32 2158static inline u32
@@ -2179,7 +2186,6 @@ static inline u32
2179_il_rd_prph(struct il_priv *il, u32 reg) 2186_il_rd_prph(struct il_priv *il, u32 reg)
2180{ 2187{
2181 _il_wr(il, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); 2188 _il_wr(il, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
2182 rmb();
2183 return _il_rd(il, HBUS_TARG_PRPH_RDAT); 2189 return _il_rd(il, HBUS_TARG_PRPH_RDAT);
2184} 2190}
2185 2191
@@ -2187,7 +2193,6 @@ static inline void
2187_il_wr_prph(struct il_priv *il, u32 addr, u32 val) 2193_il_wr_prph(struct il_priv *il, u32 addr, u32 val)
2188{ 2194{
2189 _il_wr(il, HBUS_TARG_PRPH_WADDR, ((addr & 0x0000FFFF) | (3 << 24))); 2195 _il_wr(il, HBUS_TARG_PRPH_WADDR, ((addr & 0x0000FFFF) | (3 << 24)));
2190 wmb();
2191 _il_wr(il, HBUS_TARG_PRPH_WDAT, val); 2196 _il_wr(il, HBUS_TARG_PRPH_WDAT, val);
2192} 2197}
2193 2198