aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_init.c15
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h16
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c9
3 files changed, 18 insertions, 22 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index fc67c937e172..4e26946f7ab2 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -430,14 +430,6 @@ static void ath9k_regwrite_flush(void *hw_priv)
430 mutex_unlock(&priv->wmi->multi_write_mutex); 430 mutex_unlock(&priv->wmi->multi_write_mutex);
431} 431}
432 432
433static const struct ath_ops ath9k_common_ops = {
434 .read = ath9k_regread,
435 .multi_read = ath9k_multi_regread,
436 .write = ath9k_regwrite,
437 .enable_write_buffer = ath9k_enable_regwrite_buffer,
438 .write_flush = ath9k_regwrite_flush,
439};
440
441static void ath_usb_read_cachesize(struct ath_common *common, int *csz) 433static void ath_usb_read_cachesize(struct ath_common *common, int *csz)
442{ 434{
443 *csz = L1_CACHE_BYTES >> 2; 435 *csz = L1_CACHE_BYTES >> 2;
@@ -658,10 +650,15 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
658 ah->hw_version.subsysid = 0; /* FIXME */ 650 ah->hw_version.subsysid = 0; /* FIXME */
659 ah->hw_version.usbdev = drv_info; 651 ah->hw_version.usbdev = drv_info;
660 ah->ah_flags |= AH_USE_EEPROM; 652 ah->ah_flags |= AH_USE_EEPROM;
653 ah->reg_ops.read = ath9k_regread;
654 ah->reg_ops.multi_read = ath9k_multi_regread;
655 ah->reg_ops.write = ath9k_regwrite;
656 ah->reg_ops.enable_write_buffer = ath9k_enable_regwrite_buffer;
657 ah->reg_ops.write_flush = ath9k_regwrite_flush;
661 priv->ah = ah; 658 priv->ah = ah;
662 659
663 common = ath9k_hw_common(ah); 660 common = ath9k_hw_common(ah);
664 common->ops = &ath9k_common_ops; 661 common->ops = &ah->reg_ops;
665 common->bus_ops = &ath9k_usb_bus_ops; 662 common->bus_ops = &ath9k_usb_bus_ops;
666 common->ah = ah; 663 common->ah = ah;
667 common->hw = priv->hw; 664 common->hw = priv->hw;
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index c819973c7c84..ef387a2f54b2 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -65,24 +65,24 @@
65 65
66/* Register read/write primitives */ 66/* Register read/write primitives */
67#define REG_WRITE(_ah, _reg, _val) \ 67#define REG_WRITE(_ah, _reg, _val) \
68 ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg)) 68 (_ah)->reg_ops.write((_ah), (_val), (_reg))
69 69
70#define REG_READ(_ah, _reg) \ 70#define REG_READ(_ah, _reg) \
71 ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) 71 (_ah)->reg_ops.read((_ah), (_reg))
72 72
73#define REG_READ_MULTI(_ah, _addr, _val, _cnt) \ 73#define REG_READ_MULTI(_ah, _addr, _val, _cnt) \
74 ath9k_hw_common(_ah)->ops->multi_read((_ah), (_addr), (_val), (_cnt)) 74 (_ah)->reg_ops.multi_read((_ah), (_addr), (_val), (_cnt))
75 75
76#define ENABLE_REGWRITE_BUFFER(_ah) \ 76#define ENABLE_REGWRITE_BUFFER(_ah) \
77 do { \ 77 do { \
78 if (ath9k_hw_common(_ah)->ops->enable_write_buffer) \ 78 if ((_ah)->reg_ops.enable_write_buffer) \
79 ath9k_hw_common(_ah)->ops->enable_write_buffer((_ah)); \ 79 (_ah)->reg_ops.enable_write_buffer((_ah)); \
80 } while (0) 80 } while (0)
81 81
82#define REGWRITE_BUFFER_FLUSH(_ah) \ 82#define REGWRITE_BUFFER_FLUSH(_ah) \
83 do { \ 83 do { \
84 if (ath9k_hw_common(_ah)->ops->write_flush) \ 84 if ((_ah)->reg_ops.write_flush) \
85 ath9k_hw_common(_ah)->ops->write_flush((_ah)); \ 85 (_ah)->reg_ops.write_flush((_ah)); \
86 } while (0) 86 } while (0)
87 87
88#define SM(_v, _f) (((_v) << _f##_S) & _f) 88#define SM(_v, _f) (((_v) << _f##_S) & _f)
@@ -657,6 +657,8 @@ struct ath_nf_limits {
657#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ 657#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */
658 658
659struct ath_hw { 659struct ath_hw {
660 struct ath_ops reg_ops;
661
660 struct ieee80211_hw *hw; 662 struct ieee80211_hw *hw;
661 struct ath_common common; 663 struct ath_common common;
662 struct ath9k_hw_version hw_version; 664 struct ath9k_hw_version hw_version;
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index b590a9e7943a..da114c2f0dbe 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -196,11 +196,6 @@ static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset)
196 return val; 196 return val;
197} 197}
198 198
199static const struct ath_ops ath9k_common_ops = {
200 .read = ath9k_ioread32,
201 .write = ath9k_iowrite32,
202};
203
204/**************************/ 199/**************************/
205/* Initialization */ 200/* Initialization */
206/**************************/ 201/**************************/
@@ -551,6 +546,8 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
551 ah->hw = sc->hw; 546 ah->hw = sc->hw;
552 ah->hw_version.devid = devid; 547 ah->hw_version.devid = devid;
553 ah->hw_version.subsysid = subsysid; 548 ah->hw_version.subsysid = subsysid;
549 ah->reg_ops.read = ath9k_ioread32;
550 ah->reg_ops.write = ath9k_iowrite32;
554 sc->sc_ah = ah; 551 sc->sc_ah = ah;
555 552
556 if (!pdata) { 553 if (!pdata) {
@@ -563,7 +560,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
563 } 560 }
564 561
565 common = ath9k_hw_common(ah); 562 common = ath9k_hw_common(ah);
566 common->ops = &ath9k_common_ops; 563 common->ops = &ah->reg_ops;
567 common->bus_ops = bus_ops; 564 common->bus_ops = bus_ops;
568 common->ah = ah; 565 common->ah = ah;
569 common->hw = sc->hw; 566 common->hw = sc->hw;