aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-09-10 19:55:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:28 -0400
commite5aa847489e543e33a7c72898e72183871ce2916 (patch)
treee9b2efd90abd3c7e9f02039e8f6b2f1a15d89335 /drivers/net/wireless/ath/ath5k
parent9adca126dbf4bf099bc7051deb6b566725a046dc (diff)
ath5k: define ath_common ops
Only common ath read/write ops go through the common ops. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k')
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h16
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c17
-rw-r--r--drivers/net/wireless/ath/ath5k/base.h11
3 files changed, 27 insertions, 17 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 29ce868b1f1c..1416562e4d19 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -1315,17 +1315,21 @@ static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo)
1315 return turbo ? (clock / 80) : (clock / 40); 1315 return turbo ? (clock / 80) : (clock / 40);
1316} 1316}
1317 1317
1318/* 1318static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
1319 * Read from a register 1319{
1320 */ 1320 return &ah->common;
1321}
1322
1323static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
1324{
1325 return &(ath5k_hw_common(ah)->regulatory);
1326}
1327
1321static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg) 1328static inline u32 ath5k_hw_reg_read(struct ath5k_hw *ah, u16 reg)
1322{ 1329{
1323 return ioread32(ah->ah_iobase + reg); 1330 return ioread32(ah->ah_iobase + reg);
1324} 1331}
1325 1332
1326/*
1327 * Write to a register
1328 */
1329static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg) 1333static inline void ath5k_hw_reg_write(struct ath5k_hw *ah, u32 val, u16 reg)
1330{ 1334{
1331 iowrite32(val, ah->ah_iobase + reg); 1335 iowrite32(val, ah->ah_iobase + reg);
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 3cb07520d47b..13bbf3dfc6c3 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -437,6 +437,22 @@ ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)
437 437
438 return name; 438 return name;
439} 439}
440static unsigned int ath5k_ioread32(void *hw_priv, u32 reg_offset)
441{
442 struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
443 return ath5k_hw_reg_read(ah, reg_offset);
444}
445
446static void ath5k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
447{
448 struct ath5k_hw *ah = (struct ath5k_hw *) hw_priv;
449 ath5k_hw_reg_write(ah, val, reg_offset);
450}
451
452static const struct ath_ops ath5k_common_ops = {
453 .read = ath5k_ioread32,
454 .write = ath5k_iowrite32,
455};
440 456
441static int __devinit 457static int __devinit
442ath5k_pci_probe(struct pci_dev *pdev, 458ath5k_pci_probe(struct pci_dev *pdev,
@@ -576,6 +592,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
576 sc->ah->ah_sc = sc; 592 sc->ah->ah_sc = sc;
577 sc->ah->ah_iobase = sc->iobase; 593 sc->ah->ah_iobase = sc->iobase;
578 common = ath5k_hw_common(sc->ah); 594 common = ath5k_hw_common(sc->ah);
595 common->ops = &ath5k_common_ops;
579 common->cachelsz = csz << 2; /* convert to bytes */ 596 common->cachelsz = csz << 2; /* convert to bytes */
580 597
581 /* Initialize device */ 598 /* Initialize device */
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 005d25f2e130..b14ba07e9157 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -201,15 +201,4 @@ struct ath5k_softc {
201#define ath5k_hw_hasveol(_ah) \ 201#define ath5k_hw_hasveol(_ah) \
202 (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0) 202 (ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
203 203
204static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
205{
206 return &ah->common;
207}
208
209static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
210{
211 return &(ath5k_hw_common(ah)->regulatory);
212
213}
214
215#endif 204#endif