diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-03-14 11:40:25 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-15 13:45:03 -0400 |
commit | f3eef64521f82330b4b173584d776b8a04b3e795 (patch) | |
tree | b9f9b9700322951c24f38f978fd76c5ffd2d81e8 /drivers/net/wireless/ath/ath9k | |
parent | 99ac8cd6ff44e733acdff0d36475dce2d3fe6a6b (diff) |
ath9k: optimize register access functions
By checking for NR_CPUS, the compiler can optimize out register access
serialization code on non-SMP kernels
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index b92cf01cfd19..ce9577ebaf2b 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -556,7 +556,7 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
556 | return -EIO; | 556 | return -EIO; |
557 | } | 557 | } |
558 | 558 | ||
559 | if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) { | 559 | if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) { |
560 | if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || | 560 | if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || |
561 | ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) && | 561 | ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) && |
562 | !ah->is_pciexpress)) { | 562 | !ah->is_pciexpress)) { |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 8cb37429b216..60159f4ee532 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -172,7 +172,7 @@ static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset) | |||
172 | struct ath_common *common = ath9k_hw_common(ah); | 172 | struct ath_common *common = ath9k_hw_common(ah); |
173 | struct ath_softc *sc = (struct ath_softc *) common->priv; | 173 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
174 | 174 | ||
175 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) { | 175 | if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) { |
176 | unsigned long flags; | 176 | unsigned long flags; |
177 | spin_lock_irqsave(&sc->sc_serial_rw, flags); | 177 | spin_lock_irqsave(&sc->sc_serial_rw, flags); |
178 | iowrite32(val, sc->mem + reg_offset); | 178 | iowrite32(val, sc->mem + reg_offset); |
@@ -188,7 +188,7 @@ static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset) | |||
188 | struct ath_softc *sc = (struct ath_softc *) common->priv; | 188 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
189 | u32 val; | 189 | u32 val; |
190 | 190 | ||
191 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) { | 191 | if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) { |
192 | unsigned long flags; | 192 | unsigned long flags; |
193 | spin_lock_irqsave(&sc->sc_serial_rw, flags); | 193 | spin_lock_irqsave(&sc->sc_serial_rw, flags); |
194 | val = ioread32(sc->mem + reg_offset); | 194 | val = ioread32(sc->mem + reg_offset); |
@@ -219,7 +219,7 @@ static unsigned int ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 cl | |||
219 | unsigned long uninitialized_var(flags); | 219 | unsigned long uninitialized_var(flags); |
220 | u32 val; | 220 | u32 val; |
221 | 221 | ||
222 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) { | 222 | if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_ON) { |
223 | spin_lock_irqsave(&sc->sc_serial_rw, flags); | 223 | spin_lock_irqsave(&sc->sc_serial_rw, flags); |
224 | val = __ath9k_reg_rmw(sc, reg_offset, set, clr); | 224 | val = __ath9k_reg_rmw(sc, reg_offset, set, clr); |
225 | spin_unlock_irqrestore(&sc->sc_serial_rw, flags); | 225 | spin_unlock_irqrestore(&sc->sc_serial_rw, flags); |