diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-09-28 02:54:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:42 -0400 |
commit | bc974f4a230756faf4f69114f271de2e678b363b (patch) | |
tree | 44b132a4a5de62ade4d02b42c70faa70bc84254e /drivers/net/wireless | |
parent | 7c89606e24cdabaceb8ca9b3c7ab866c6bcc9e38 (diff) |
atheros: define a common priv struct
hw code should never use private driver data, but
sometimes we need a backpointer so just stuff it on
the common ath struct.
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.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/pci.c | 9 |
5 files changed, 31 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index e0341fefc921..b6cd752df839 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -56,6 +56,7 @@ struct ath_bus_ops { | |||
56 | 56 | ||
57 | struct ath_common { | 57 | struct ath_common { |
58 | void *ah; | 58 | void *ah; |
59 | void *priv; | ||
59 | struct ieee80211_hw *hw; | 60 | struct ieee80211_hw *hw; |
60 | int debug_mask; | 61 | int debug_mask; |
61 | 62 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 352914cae6d8..25ae88ebdfac 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -562,8 +562,8 @@ static const struct file_operations fops_xmit = { | |||
562 | 562 | ||
563 | int ath9k_init_debug(struct ath_hw *ah) | 563 | int ath9k_init_debug(struct ath_hw *ah) |
564 | { | 564 | { |
565 | struct ath_softc *sc = ah->ah_sc; | 565 | struct ath_common *common = ath9k_hw_common(ah); |
566 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 566 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
567 | 567 | ||
568 | common->debug_mask = ath9k_debug; | 568 | common->debug_mask = ath9k_debug; |
569 | 569 | ||
@@ -620,7 +620,8 @@ err: | |||
620 | 620 | ||
621 | void ath9k_exit_debug(struct ath_hw *ah) | 621 | void ath9k_exit_debug(struct ath_hw *ah) |
622 | { | 622 | { |
623 | struct ath_softc *sc = ah->ah_sc; | 623 | struct ath_common *common = ath9k_hw_common(ah); |
624 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
624 | 625 | ||
625 | debugfs_remove(sc->debug.debugfs_xmit); | 626 | debugfs_remove(sc->debug.debugfs_xmit); |
626 | debugfs_remove(sc->debug.debugfs_wiphy); | 627 | debugfs_remove(sc->debug.debugfs_wiphy); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index f782c1a06b34..cdaec526db35 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -450,7 +450,6 @@ struct ath_gen_timer_table { | |||
450 | 450 | ||
451 | struct ath_hw { | 451 | struct ath_hw { |
452 | struct ieee80211_hw *hw; | 452 | struct ieee80211_hw *hw; |
453 | struct ath_softc *ah_sc; | ||
454 | struct ath_common common; | 453 | struct ath_common common; |
455 | struct ath9k_hw_version hw_version; | 454 | struct ath9k_hw_version hw_version; |
456 | struct ath9k_ops_config config; | 455 | struct ath9k_ops_config config; |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 2278dcbeee16..86374ad9313c 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1438,17 +1438,22 @@ static void ath9k_gen_timer_start(struct ath_hw *ah, | |||
1438 | u32 timer_next, | 1438 | u32 timer_next, |
1439 | u32 timer_period) | 1439 | u32 timer_period) |
1440 | { | 1440 | { |
1441 | struct ath_common *common = ath9k_hw_common(ah); | ||
1442 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
1443 | |||
1441 | ath9k_hw_gen_timer_start(ah, timer, timer_next, timer_period); | 1444 | ath9k_hw_gen_timer_start(ah, timer, timer_next, timer_period); |
1442 | 1445 | ||
1443 | if ((ah->ah_sc->imask & ATH9K_INT_GENTIMER) == 0) { | 1446 | if ((sc->imask & ATH9K_INT_GENTIMER) == 0) { |
1444 | ath9k_hw_set_interrupts(ah, 0); | 1447 | ath9k_hw_set_interrupts(ah, 0); |
1445 | ah->ah_sc->imask |= ATH9K_INT_GENTIMER; | 1448 | sc->imask |= ATH9K_INT_GENTIMER; |
1446 | ath9k_hw_set_interrupts(ah, ah->ah_sc->imask); | 1449 | ath9k_hw_set_interrupts(ah, sc->imask); |
1447 | } | 1450 | } |
1448 | } | 1451 | } |
1449 | 1452 | ||
1450 | static void ath9k_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) | 1453 | static void ath9k_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) |
1451 | { | 1454 | { |
1455 | struct ath_common *common = ath9k_hw_common(ah); | ||
1456 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
1452 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; | 1457 | struct ath_gen_timer_table *timer_table = &ah->hw_gen_timers; |
1453 | 1458 | ||
1454 | ath9k_hw_gen_timer_stop(ah, timer); | 1459 | ath9k_hw_gen_timer_stop(ah, timer); |
@@ -1456,8 +1461,8 @@ static void ath9k_gen_timer_stop(struct ath_hw *ah, struct ath_gen_timer *timer) | |||
1456 | /* if no timer is enabled, turn off interrupt mask */ | 1461 | /* if no timer is enabled, turn off interrupt mask */ |
1457 | if (timer_table->timer_mask.val == 0) { | 1462 | if (timer_table->timer_mask.val == 0) { |
1458 | ath9k_hw_set_interrupts(ah, 0); | 1463 | ath9k_hw_set_interrupts(ah, 0); |
1459 | ah->ah_sc->imask &= ~ATH9K_INT_GENTIMER; | 1464 | sc->imask &= ~ATH9K_INT_GENTIMER; |
1460 | ath9k_hw_set_interrupts(ah, ah->ah_sc->imask); | 1465 | ath9k_hw_set_interrupts(ah, sc->imask); |
1461 | } | 1466 | } |
1462 | } | 1467 | } |
1463 | 1468 | ||
@@ -1554,28 +1559,32 @@ static int ath_init_btcoex_timer(struct ath_softc *sc) | |||
1554 | static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset) | 1559 | static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset) |
1555 | { | 1560 | { |
1556 | struct ath_hw *ah = (struct ath_hw *) hw_priv; | 1561 | struct ath_hw *ah = (struct ath_hw *) hw_priv; |
1562 | struct ath_common *common = ath9k_hw_common(ah); | ||
1563 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
1557 | 1564 | ||
1558 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) { | 1565 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) { |
1559 | unsigned long flags; | 1566 | unsigned long flags; |
1560 | spin_lock_irqsave(&ah->ah_sc->sc_serial_rw, flags); | 1567 | spin_lock_irqsave(&sc->sc_serial_rw, flags); |
1561 | iowrite32(val, ah->ah_sc->mem + reg_offset); | 1568 | iowrite32(val, sc->mem + reg_offset); |
1562 | spin_unlock_irqrestore(&ah->ah_sc->sc_serial_rw, flags); | 1569 | spin_unlock_irqrestore(&sc->sc_serial_rw, flags); |
1563 | } else | 1570 | } else |
1564 | iowrite32(val, ah->ah_sc->mem + reg_offset); | 1571 | iowrite32(val, sc->mem + reg_offset); |
1565 | } | 1572 | } |
1566 | 1573 | ||
1567 | static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset) | 1574 | static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset) |
1568 | { | 1575 | { |
1569 | struct ath_hw *ah = (struct ath_hw *) hw_priv; | 1576 | struct ath_hw *ah = (struct ath_hw *) hw_priv; |
1577 | struct ath_common *common = ath9k_hw_common(ah); | ||
1578 | struct ath_softc *sc = (struct ath_softc *) common->priv; | ||
1570 | u32 val; | 1579 | u32 val; |
1571 | 1580 | ||
1572 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) { | 1581 | if (ah->config.serialize_regmode == SER_REG_MODE_ON) { |
1573 | unsigned long flags; | 1582 | unsigned long flags; |
1574 | spin_lock_irqsave(&ah->ah_sc->sc_serial_rw, flags); | 1583 | spin_lock_irqsave(&sc->sc_serial_rw, flags); |
1575 | val = ioread32(ah->ah_sc->mem + reg_offset); | 1584 | val = ioread32(sc->mem + reg_offset); |
1576 | spin_unlock_irqrestore(&ah->ah_sc->sc_serial_rw, flags); | 1585 | spin_unlock_irqrestore(&sc->sc_serial_rw, flags); |
1577 | } else | 1586 | } else |
1578 | val = ioread32(ah->ah_sc->mem + reg_offset); | 1587 | val = ioread32(sc->mem + reg_offset); |
1579 | return val; | 1588 | return val; |
1580 | } | 1589 | } |
1581 | 1590 | ||
@@ -1618,7 +1627,6 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
1618 | goto bad_no_ah; | 1627 | goto bad_no_ah; |
1619 | } | 1628 | } |
1620 | 1629 | ||
1621 | ah->ah_sc = sc; | ||
1622 | ah->hw_version.devid = devid; | 1630 | ah->hw_version.devid = devid; |
1623 | ah->hw_version.subsysid = subsysid; | 1631 | ah->hw_version.subsysid = subsysid; |
1624 | sc->sc_ah = ah; | 1632 | sc->sc_ah = ah; |
@@ -1628,6 +1636,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
1628 | common->bus_ops = bus_ops; | 1636 | common->bus_ops = bus_ops; |
1629 | common->ah = ah; | 1637 | common->ah = ah; |
1630 | common->hw = sc->hw; | 1638 | common->hw = sc->hw; |
1639 | common->priv = sc; | ||
1631 | 1640 | ||
1632 | /* | 1641 | /* |
1633 | * Cache line size is used to size and align various | 1642 | * Cache line size is used to size and align various |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index b2a45ce62698..63059b6a90da 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -33,8 +33,7 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = { | |||
33 | /* return bus cachesize in 4B word units */ | 33 | /* return bus cachesize in 4B word units */ |
34 | static void ath_pci_read_cachesize(struct ath_common *common, int *csz) | 34 | static void ath_pci_read_cachesize(struct ath_common *common, int *csz) |
35 | { | 35 | { |
36 | struct ath_hw *ah = (struct ath_hw *) common->ah; | 36 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
37 | struct ath_softc *sc = ah->ah_sc; | ||
38 | u8 u8tmp; | 37 | u8 u8tmp; |
39 | 38 | ||
40 | pci_read_config_byte(to_pci_dev(sc->dev), PCI_CACHE_LINE_SIZE, &u8tmp); | 39 | pci_read_config_byte(to_pci_dev(sc->dev), PCI_CACHE_LINE_SIZE, &u8tmp); |
@@ -52,8 +51,7 @@ static void ath_pci_read_cachesize(struct ath_common *common, int *csz) | |||
52 | 51 | ||
53 | static void ath_pci_cleanup(struct ath_common *common) | 52 | static void ath_pci_cleanup(struct ath_common *common) |
54 | { | 53 | { |
55 | struct ath_hw *ah = (struct ath_hw *) common->ah; | 54 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
56 | struct ath_softc *sc = ah->ah_sc; | ||
57 | struct pci_dev *pdev = to_pci_dev(sc->dev); | 55 | struct pci_dev *pdev = to_pci_dev(sc->dev); |
58 | 56 | ||
59 | pci_iounmap(pdev, sc->mem); | 57 | pci_iounmap(pdev, sc->mem); |
@@ -86,8 +84,7 @@ static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data) | |||
86 | */ | 84 | */ |
87 | static void ath_pci_bt_coex_prep(struct ath_common *common) | 85 | static void ath_pci_bt_coex_prep(struct ath_common *common) |
88 | { | 86 | { |
89 | struct ath_hw *ah = (struct ath_hw *) common->ah; | 87 | struct ath_softc *sc = (struct ath_softc *) common->priv; |
90 | struct ath_softc *sc = ah->ah_sc; | ||
91 | struct pci_dev *pdev = to_pci_dev(sc->dev); | 88 | struct pci_dev *pdev = to_pci_dev(sc->dev); |
92 | u8 aspm; | 89 | u8 aspm; |
93 | 90 | ||