aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-09-14 03:55:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:30 -0400
commit5bb127913299b37fceecf66ce86ee8ede70e7d13 (patch)
tree9856d3469b448bab7f425aac962f5a9a46ace9e6 /drivers/net/wireless
parent990b70ab24cbce585a3436c8c88cb48b888d48b4 (diff)
atheros: move bus ops to ath_common
This is the last part to make ath9k hw code core driver agnostic. I believe ath9k_htc can now use use the hw code unmodified. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath.h10
-rw-r--r--drivers/net/wireless/ath/ath9k/Makefile3
-rw-r--r--drivers/net/wireless/ath/ath9k/ahb.c14
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h19
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_4k.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_9287.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_def.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c20
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c21
11 files changed, 66 insertions, 48 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index 38ca68ee09c0..e0341fefc921 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -45,6 +45,15 @@ struct ath_ops {
45 void (*write)(void *, u32 val, u32 reg_offset); 45 void (*write)(void *, u32 val, u32 reg_offset);
46}; 46};
47 47
48struct ath_common;
49
50struct ath_bus_ops {
51 void (*read_cachesize)(struct ath_common *common, int *csz);
52 void (*cleanup)(struct ath_common *common);
53 bool (*eeprom_read)(struct ath_common *common, u32 off, u16 *data);
54 void (*bt_coex_prep)(struct ath_common *common);
55};
56
48struct ath_common { 57struct ath_common {
49 void *ah; 58 void *ah;
50 struct ieee80211_hw *hw; 59 struct ieee80211_hw *hw;
@@ -61,6 +70,7 @@ struct ath_common {
61 70
62 struct ath_regulatory regulatory; 71 struct ath_regulatory regulatory;
63 const struct ath_ops *ops; 72 const struct ath_ops *ops;
73 const struct ath_bus_ops *bus_ops;
64}; 74};
65 75
66struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, 76struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile
index 2f21c67d86c8..f3221af73eb7 100644
--- a/drivers/net/wireless/ath/ath9k/Makefile
+++ b/drivers/net/wireless/ath/ath9k/Makefile
@@ -1,5 +1,5 @@
1ATH9K_HW_FIX += eeprom.o
2ATH9K_HW += hw.o \ 1ATH9K_HW += hw.o \
2 eeprom.o \
3 eeprom_def.o \ 3 eeprom_def.o \
4 eeprom_4k.o \ 4 eeprom_4k.o \
5 eeprom_9287.o \ 5 eeprom_9287.o \
@@ -10,7 +10,6 @@ ATH9K_HW += hw.o \
10 mac.o \ 10 mac.o \
11 11
12ath9k-y += $(ATH9K_HW) \ 12ath9k-y += $(ATH9K_HW) \
13 $(ATH9K_HW_FIX) \
14 beacon.o \ 13 beacon.o \
15 main.o \ 14 main.o \
16 recv.o \ 15 recv.o \
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index 095973e8b232..33c9e8167185 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -22,25 +22,28 @@
22#include "ath9k.h" 22#include "ath9k.h"
23 23
24/* return bus cachesize in 4B word units */ 24/* return bus cachesize in 4B word units */
25static void ath_ahb_read_cachesize(struct ath_softc *sc, int *csz) 25static void ath_ahb_read_cachesize(struct ath_common *common, int *csz)
26{ 26{
27 *csz = L1_CACHE_BYTES >> 2; 27 *csz = L1_CACHE_BYTES >> 2;
28} 28}
29 29
30static void ath_ahb_cleanup(struct ath_softc *sc) 30static void ath_ahb_cleanup(struct ath_common *common)
31{ 31{
32 struct ath_hw *ah = (struct ath_hw *) common->ah;
33 struct ath_softc *sc = ah->ah_sc;
32 iounmap(sc->mem); 34 iounmap(sc->mem);
33} 35}
34 36
35static bool ath_ahb_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) 37static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
36{ 38{
39 struct ath_hw *ah = (struct ath_hw *) common->ah;
37 struct ath_softc *sc = ah->ah_sc; 40 struct ath_softc *sc = ah->ah_sc;
38 struct platform_device *pdev = to_platform_device(sc->dev); 41 struct platform_device *pdev = to_platform_device(sc->dev);
39 struct ath9k_platform_data *pdata; 42 struct ath9k_platform_data *pdata;
40 43
41 pdata = (struct ath9k_platform_data *) pdev->dev.platform_data; 44 pdata = (struct ath9k_platform_data *) pdev->dev.platform_data;
42 if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { 45 if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
43 ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 46 ath_print(common, ATH_DBG_FATAL,
44 "%s: flash read failed, offset %08x " 47 "%s: flash read failed, offset %08x "
45 "is out of range\n", 48 "is out of range\n",
46 __func__, off); 49 __func__, off);
@@ -117,10 +120,9 @@ static int ath_ahb_probe(struct platform_device *pdev)
117 sc->hw = hw; 120 sc->hw = hw;
118 sc->dev = &pdev->dev; 121 sc->dev = &pdev->dev;
119 sc->mem = mem; 122 sc->mem = mem;
120 sc->bus_ops = &ath_ahb_bus_ops;
121 sc->irq = irq; 123 sc->irq = irq;
122 124
123 ret = ath_init_device(AR5416_AR9100_DEVID, sc, 0x0); 125 ret = ath_init_device(AR5416_AR9100_DEVID, sc, 0x0, &ath_ahb_bus_ops);
124 if (ret) { 126 if (ret) {
125 dev_err(&pdev->dev, "failed to initialize device\n"); 127 dev_err(&pdev->dev, "failed to initialize device\n");
126 goto err_free_hw; 128 goto err_free_hw;
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 8768e603eb72..14ff38d1f67c 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -537,13 +537,6 @@ struct ath_led {
537#define SC_OP_BEACON_SYNC BIT(19) 537#define SC_OP_BEACON_SYNC BIT(19)
538#define SC_OP_BT_PRIORITY_DETECTED BIT(21) 538#define SC_OP_BT_PRIORITY_DETECTED BIT(21)
539 539
540struct ath_bus_ops {
541 void (*read_cachesize)(struct ath_softc *sc, int *csz);
542 void (*cleanup)(struct ath_softc *sc);
543 bool (*eeprom_read)(struct ath_hw *ah, u32 off, u16 *data);
544 void (*bt_coex_prep)(struct ath_softc *sc);
545};
546
547struct ath_wiphy; 540struct ath_wiphy;
548 541
549struct ath_softc { 542struct ath_softc {
@@ -613,7 +606,6 @@ struct ath_softc {
613#ifdef CONFIG_ATH9K_DEBUG 606#ifdef CONFIG_ATH9K_DEBUG
614 struct ath9k_debug debug; 607 struct ath9k_debug debug;
615#endif 608#endif
616 struct ath_bus_ops *bus_ops;
617 struct ath_beacon_config cur_beacon_conf; 609 struct ath_beacon_config cur_beacon_conf;
618 struct delayed_work tx_complete_work; 610 struct delayed_work tx_complete_work;
619 struct ath_btcoex btcoex; 611 struct ath_btcoex btcoex;
@@ -638,21 +630,22 @@ int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);
638int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc); 630int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
639int ath_cabq_update(struct ath_softc *); 631int ath_cabq_update(struct ath_softc *);
640 632
641static inline void ath_read_cachesize(struct ath_softc *sc, int *csz) 633static inline void ath_read_cachesize(struct ath_common *common, int *csz)
642{ 634{
643 sc->bus_ops->read_cachesize(sc, csz); 635 common->bus_ops->read_cachesize(common, csz);
644} 636}
645 637
646static inline void ath_bus_cleanup(struct ath_softc *sc) 638static inline void ath_bus_cleanup(struct ath_common *common)
647{ 639{
648 sc->bus_ops->cleanup(sc); 640 common->bus_ops->cleanup(common);
649} 641}
650 642
651extern struct ieee80211_ops ath9k_ops; 643extern struct ieee80211_ops ath9k_ops;
652 644
653irqreturn_t ath_isr(int irq, void *dev); 645irqreturn_t ath_isr(int irq, void *dev);
654void ath_cleanup(struct ath_softc *sc); 646void ath_cleanup(struct ath_softc *sc);
655int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid); 647int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
648 const struct ath_bus_ops *bus_ops);
656void ath_detach(struct ath_softc *sc); 649void ath_detach(struct ath_softc *sc);
657const char *ath_mac_bb_name(u32 mac_bb_version); 650const char *ath_mac_bb_name(u32 mac_bb_version);
658const char *ath_rf_name(u16 rf_version); 651const char *ath_rf_name(u16 rf_version);
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index b6e52d0f8c48..dacaae934148 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include "ath9k.h" 17#include "hw.h"
18 18
19static inline u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz) 19static inline u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz)
20{ 20{
@@ -83,11 +83,9 @@ bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize,
83 return false; 83 return false;
84} 84}
85 85
86bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data) 86bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data)
87{ 87{
88 struct ath_softc *sc = ah->ah_sc; 88 return common->bus_ops->eeprom_read(common, off, data);
89
90 return sc->bus_ops->eeprom_read(ah, off, data);
91} 89}
92 90
93void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, 91void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h
index 4fe33f7eee9d..8463ba09c12c 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/eeprom.h
@@ -17,6 +17,7 @@
17#ifndef EEPROM_H 17#ifndef EEPROM_H
18#define EEPROM_H 18#define EEPROM_H
19 19
20#include "../ath.h"
20#include <net/cfg80211.h> 21#include <net/cfg80211.h>
21 22
22#define AH_USE_EEPROM 0x1 23#define AH_USE_EEPROM 0x1
@@ -684,7 +685,7 @@ int16_t ath9k_hw_interpolate(u16 target, u16 srcLeft, u16 srcRight,
684 int16_t targetRight); 685 int16_t targetRight);
685bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize, 686bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList, u16 listSize,
686 u16 *indexL, u16 *indexR); 687 u16 *indexL, u16 *indexR);
687bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data); 688bool ath9k_hw_nvram_read(struct ath_common *common, u32 off, u16 *data);
688void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList, 689void ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
689 u8 *pVpdList, u16 numIntercepts, 690 u8 *pVpdList, u16 numIntercepts,
690 u8 *pRetVpdList); 691 u8 *pRetVpdList);
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index c2ac85c2aab7..2a27b1d51a1b 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -41,7 +41,7 @@ static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
41 } 41 }
42 42
43 for (addr = 0; addr < SIZE_EEPROM_4K; addr++) { 43 for (addr = 0; addr < SIZE_EEPROM_4K; addr++) {
44 if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) { 44 if (!ath9k_hw_nvram_read(common, addr + eep_start_loc, eep_data)) {
45 ath_print(common, ATH_DBG_EEPROM, 45 ath_print(common, ATH_DBG_EEPROM,
46 "Unable to read eeprom region \n"); 46 "Unable to read eeprom region \n");
47 return false; 47 return false;
@@ -66,7 +66,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
66 66
67 67
68 if (!ath9k_hw_use_flash(ah)) { 68 if (!ath9k_hw_use_flash(ah)) {
69 if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, 69 if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET,
70 &magic)) { 70 &magic)) {
71 ath_print(common, ATH_DBG_FATAL, 71 ath_print(common, ATH_DBG_FATAL,
72 "Reading Magic # failed\n"); 72 "Reading Magic # failed\n");
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
index 839eed89179d..839d05a1df29 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c
@@ -41,7 +41,8 @@ static bool ath9k_hw_AR9287_fill_eeprom(struct ath_hw *ah)
41 41
42 for (addr = 0; addr < sizeof(struct ar9287_eeprom) / sizeof(u16); 42 for (addr = 0; addr < sizeof(struct ar9287_eeprom) / sizeof(u16);
43 addr++) { 43 addr++) {
44 if (!ath9k_hw_nvram_read(ah, addr + eep_start_loc, eep_data)) { 44 if (!ath9k_hw_nvram_read(common,
45 addr + eep_start_loc, eep_data)) {
45 ath_print(common, ATH_DBG_EEPROM, 46 ath_print(common, ATH_DBG_EEPROM,
46 "Unable to read eeprom region \n"); 47 "Unable to read eeprom region \n");
47 return false; 48 return false;
@@ -61,8 +62,8 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)
61 struct ath_common *common = ath9k_hw_common(ah); 62 struct ath_common *common = ath9k_hw_common(ah);
62 63
63 if (!ath9k_hw_use_flash(ah)) { 64 if (!ath9k_hw_use_flash(ah)) {
64 if (!ath9k_hw_nvram_read 65 if (!ath9k_hw_nvram_read(common,
65 (ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { 66 AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
66 ath_print(common, ATH_DBG_FATAL, 67 ath_print(common, ATH_DBG_FATAL,
67 "Reading Magic # failed\n"); 68 "Reading Magic # failed\n");
68 return false; 69 return false;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index 56e90baf6949..8f04b644e2e6 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -89,11 +89,12 @@ static int ath9k_hw_def_get_eeprom_rev(struct ath_hw *ah)
89static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah) 89static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah)
90{ 90{
91#define SIZE_EEPROM_DEF (sizeof(struct ar5416_eeprom_def) / sizeof(u16)) 91#define SIZE_EEPROM_DEF (sizeof(struct ar5416_eeprom_def) / sizeof(u16))
92 struct ath_common *common = ath9k_hw_common(ah);
92 u16 *eep_data = (u16 *)&ah->eeprom.def; 93 u16 *eep_data = (u16 *)&ah->eeprom.def;
93 int addr, ar5416_eep_start_loc = 0x100; 94 int addr, ar5416_eep_start_loc = 0x100;
94 95
95 for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) { 96 for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) {
96 if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc, 97 if (!ath9k_hw_nvram_read(common, addr + ar5416_eep_start_loc,
97 eep_data)) { 98 eep_data)) {
98 ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, 99 ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL,
99 "Unable to read eeprom region\n"); 100 "Unable to read eeprom region\n");
@@ -115,7 +116,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
115 bool need_swap = false; 116 bool need_swap = false;
116 int i, addr, size; 117 int i, addr, size;
117 118
118 if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { 119 if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, &magic)) {
119 ath_print(common, ATH_DBG_FATAL, "Reading Magic # failed\n"); 120 ath_print(common, ATH_DBG_FATAL, "Reading Magic # failed\n");
120 return false; 121 return false;
121 } 122 }
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 0d8977341b2c..ab9b7eaecd81 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1311,9 +1311,12 @@ static void ath_start_rfkill_poll(struct ath_softc *sc)
1311 1311
1312void ath_cleanup(struct ath_softc *sc) 1312void ath_cleanup(struct ath_softc *sc)
1313{ 1313{
1314 struct ath_hw *ah = sc->sc_ah;
1315 struct ath_common *common = ath9k_hw_common(ah);
1316
1314 ath_detach(sc); 1317 ath_detach(sc);
1315 free_irq(sc->irq, sc); 1318 free_irq(sc->irq, sc);
1316 ath_bus_cleanup(sc); 1319 ath_bus_cleanup(common);
1317 kfree(sc->sec_wiphy); 1320 kfree(sc->sec_wiphy);
1318 ieee80211_free_hw(sc->hw); 1321 ieee80211_free_hw(sc->hw);
1319} 1322}
@@ -1587,7 +1590,8 @@ static struct ath_ops ath9k_common_ops = {
1587 * to allow the separation between hardware specific 1590 * to allow the separation between hardware specific
1588 * variables (now in ath_hw) and driver specific variables. 1591 * variables (now in ath_hw) and driver specific variables.
1589 */ 1592 */
1590static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid) 1593static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
1594 const struct ath_bus_ops *bus_ops)
1591{ 1595{
1592 struct ath_hw *ah = NULL; 1596 struct ath_hw *ah = NULL;
1593 struct ath_common *common; 1597 struct ath_common *common;
@@ -1621,6 +1625,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid)
1621 1625
1622 common = ath9k_hw_common(ah); 1626 common = ath9k_hw_common(ah);
1623 common->ops = &ath9k_common_ops; 1627 common->ops = &ath9k_common_ops;
1628 common->bus_ops = bus_ops;
1624 common->ah = ah; 1629 common->ah = ah;
1625 common->hw = sc->hw; 1630 common->hw = sc->hw;
1626 1631
@@ -1628,7 +1633,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid)
1628 * Cache line size is used to size and align various 1633 * Cache line size is used to size and align various
1629 * structures used to communicate with the hardware. 1634 * structures used to communicate with the hardware.
1630 */ 1635 */
1631 ath_read_cachesize(sc, &csz); 1636 ath_read_cachesize(common, &csz);
1632 /* XXX assert csz is non-zero */ 1637 /* XXX assert csz is non-zero */
1633 common->cachelsz = csz << 2; /* convert to bytes */ 1638 common->cachelsz = csz << 2; /* convert to bytes */
1634 1639
@@ -1876,7 +1881,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
1876} 1881}
1877 1882
1878/* Device driver core initialization */ 1883/* Device driver core initialization */
1879int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid) 1884int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid,
1885 const struct ath_bus_ops *bus_ops)
1880{ 1886{
1881 struct ieee80211_hw *hw = sc->hw; 1887 struct ieee80211_hw *hw = sc->hw;
1882 struct ath_common *common; 1888 struct ath_common *common;
@@ -1886,7 +1892,7 @@ int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid)
1886 1892
1887 dev_dbg(sc->dev, "Attach ATH hw\n"); 1893 dev_dbg(sc->dev, "Attach ATH hw\n");
1888 1894
1889 error = ath_init_softc(devid, sc, subsysid); 1895 error = ath_init_softc(devid, sc, subsysid, bus_ops);
1890 if (error != 0) 1896 if (error != 0)
1891 return error; 1897 return error;
1892 1898
@@ -2337,8 +2343,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
2337 AR_STOMP_LOW_WLAN_WGHT); 2343 AR_STOMP_LOW_WLAN_WGHT);
2338 ath9k_hw_btcoex_enable(ah); 2344 ath9k_hw_btcoex_enable(ah);
2339 2345
2340 if (sc->bus_ops->bt_coex_prep) 2346 if (common->bus_ops->bt_coex_prep)
2341 sc->bus_ops->bt_coex_prep(sc); 2347 common->bus_ops->bt_coex_prep(common);
2342 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) 2348 if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
2343 ath9k_btcoex_timer_resume(sc); 2349 ath9k_btcoex_timer_resume(sc);
2344 } 2350 }
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index f59d22491ced..a1001ffdd389 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -31,8 +31,10 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = {
31}; 31};
32 32
33/* return bus cachesize in 4B word units */ 33/* return bus cachesize in 4B word units */
34static void ath_pci_read_cachesize(struct ath_softc *sc, int *csz) 34static void ath_pci_read_cachesize(struct ath_common *common, int *csz)
35{ 35{
36 struct ath_hw *ah = (struct ath_hw *) common->ah;
37 struct ath_softc *sc = ah->ah_sc;
36 u8 u8tmp; 38 u8 u8tmp;
37 39
38 pci_read_config_byte(to_pci_dev(sc->dev), PCI_CACHE_LINE_SIZE, &u8tmp); 40 pci_read_config_byte(to_pci_dev(sc->dev), PCI_CACHE_LINE_SIZE, &u8tmp);
@@ -48,8 +50,10 @@ static void ath_pci_read_cachesize(struct ath_softc *sc, int *csz)
48 *csz = DEFAULT_CACHELINE >> 2; /* Use the default size */ 50 *csz = DEFAULT_CACHELINE >> 2; /* Use the default size */
49} 51}
50 52
51static void ath_pci_cleanup(struct ath_softc *sc) 53static void ath_pci_cleanup(struct ath_common *common)
52{ 54{
55 struct ath_hw *ah = (struct ath_hw *) common->ah;
56 struct ath_softc *sc = ah->ah_sc;
53 struct pci_dev *pdev = to_pci_dev(sc->dev); 57 struct pci_dev *pdev = to_pci_dev(sc->dev);
54 58
55 pci_iounmap(pdev, sc->mem); 59 pci_iounmap(pdev, sc->mem);
@@ -57,8 +61,10 @@ static void ath_pci_cleanup(struct ath_softc *sc)
57 pci_release_region(pdev, 0); 61 pci_release_region(pdev, 0);
58} 62}
59 63
60static bool ath_pci_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) 64static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
61{ 65{
66 struct ath_hw *ah = (struct ath_hw *) common->ah;
67
62 (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S)); 68 (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
63 69
64 if (!ath9k_hw_wait(ah, 70 if (!ath9k_hw_wait(ah,
@@ -78,8 +84,10 @@ static bool ath_pci_eeprom_read(struct ath_hw *ah, u32 off, u16 *data)
78/* 84/*
79 * Bluetooth coexistance requires disabling ASPM. 85 * Bluetooth coexistance requires disabling ASPM.
80 */ 86 */
81static void ath_pci_bt_coex_prep(struct ath_softc *sc) 87static void ath_pci_bt_coex_prep(struct ath_common *common)
82{ 88{
89 struct ath_hw *ah = (struct ath_hw *) common->ah;
90 struct ath_softc *sc = ah->ah_sc;
83 struct pci_dev *pdev = to_pci_dev(sc->dev); 91 struct pci_dev *pdev = to_pci_dev(sc->dev);
84 u8 aspm; 92 u8 aspm;
85 93
@@ -91,7 +99,7 @@ static void ath_pci_bt_coex_prep(struct ath_softc *sc)
91 pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm); 99 pci_write_config_byte(pdev, ATH_PCIE_CAP_LINK_CTRL, aspm);
92} 100}
93 101
94static struct ath_bus_ops ath_pci_bus_ops = { 102const static struct ath_bus_ops ath_pci_bus_ops = {
95 .read_cachesize = ath_pci_read_cachesize, 103 .read_cachesize = ath_pci_read_cachesize,
96 .cleanup = ath_pci_cleanup, 104 .cleanup = ath_pci_cleanup,
97 .eeprom_read = ath_pci_eeprom_read, 105 .eeprom_read = ath_pci_eeprom_read,
@@ -194,10 +202,9 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
194 sc->hw = hw; 202 sc->hw = hw;
195 sc->dev = &pdev->dev; 203 sc->dev = &pdev->dev;
196 sc->mem = mem; 204 sc->mem = mem;
197 sc->bus_ops = &ath_pci_bus_ops;
198 205
199 pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsysid); 206 pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsysid);
200 ret = ath_init_device(id->device, sc, subsysid); 207 ret = ath_init_device(id->device, sc, subsysid, &ath_pci_bus_ops);
201 if (ret) { 208 if (ret) {
202 dev_err(&pdev->dev, "failed to initialize device\n"); 209 dev_err(&pdev->dev, "failed to initialize device\n");
203 goto bad3; 210 goto bad3;