Commit db719718 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

ath5k: move ath_common to ath5k_hw

Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 27c51f1a
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
* TODO: Make a more generic struct (eg. add more stuff to ath5k_capabilities) * TODO: Make a more generic struct (eg. add more stuff to ath5k_capabilities)
* and clean up common bits, then introduce set/get functions in eeprom.c */ * and clean up common bits, then introduce set/get functions in eeprom.c */
#include "eeprom.h" #include "eeprom.h"
#include "../ath.h"
/* PCI IDs */ /* PCI IDs */
#define PCI_DEVICE_ID_ATHEROS_AR5210 0x0007 /* AR5210 */ #define PCI_DEVICE_ID_ATHEROS_AR5210 0x0007 /* AR5210 */
...@@ -1020,6 +1021,7 @@ struct ath5k_capabilities { ...@@ -1020,6 +1021,7 @@ struct ath5k_capabilities {
/* TODO: Clean up and merge with ath5k_softc */ /* TODO: Clean up and merge with ath5k_softc */
struct ath5k_hw { struct ath5k_hw {
u32 ah_magic; u32 ah_magic;
struct ath_common common;
struct ath5k_softc *ah_sc; struct ath5k_softc *ah_sc;
void __iomem *ah_iobase; void __iomem *ah_iobase;
......
...@@ -444,6 +444,7 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -444,6 +444,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
{ {
void __iomem *mem; void __iomem *mem;
struct ath5k_softc *sc; struct ath5k_softc *sc;
struct ath_common *common;
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
int ret; int ret;
u8 csz; u8 csz;
...@@ -547,7 +548,6 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -547,7 +548,6 @@ ath5k_pci_probe(struct pci_dev *pdev,
__set_bit(ATH_STAT_INVALID, sc->status); __set_bit(ATH_STAT_INVALID, sc->status);
sc->iobase = mem; /* So we can unmap it on detach */ sc->iobase = mem; /* So we can unmap it on detach */
sc->common.cachelsz = csz << 2; /* convert to bytes */
sc->opmode = NL80211_IFTYPE_STATION; sc->opmode = NL80211_IFTYPE_STATION;
sc->bintval = 1000; sc->bintval = 1000;
mutex_init(&sc->lock); mutex_init(&sc->lock);
...@@ -572,6 +572,9 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -572,6 +572,9 @@ ath5k_pci_probe(struct pci_dev *pdev,
goto err_irq; goto err_irq;
} }
common = ath5k_hw_common(sc->ah);
common->cachelsz = csz << 2; /* convert to bytes */
/* set up multi-rate retry capabilities */ /* set up multi-rate retry capabilities */
if (sc->ah->ah_version == AR5K_AR5212) { if (sc->ah->ah_version == AR5K_AR5212) {
hw->max_rates = 4; hw->max_rates = 4;
...@@ -718,7 +721,7 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re ...@@ -718,7 +721,7 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re
{ {
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
struct ath_regulatory *regulatory = &sc->common.regulatory; struct ath_regulatory *regulatory = ath5k_hw_regulatory(sc->ah);
return ath_reg_notifier_apply(wiphy, request, regulatory); return ath_reg_notifier_apply(wiphy, request, regulatory);
} }
...@@ -728,7 +731,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) ...@@ -728,7 +731,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
{ {
struct ath5k_softc *sc = hw->priv; struct ath5k_softc *sc = hw->priv;
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
struct ath_regulatory *regulatory = &sc->common.regulatory; struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah);
u8 mac[ETH_ALEN] = {}; u8 mac[ETH_ALEN] = {};
int ret; int ret;
...@@ -1153,19 +1156,20 @@ ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix) ...@@ -1153,19 +1156,20 @@ ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix)
static static
struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr) struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr)
{ {
struct ath_common *common = ath5k_hw_common(sc->ah);
struct sk_buff *skb; struct sk_buff *skb;
/* /*
* Allocate buffer with headroom_needed space for the * Allocate buffer with headroom_needed space for the
* fake physical layer header at the start. * fake physical layer header at the start.
*/ */
skb = ath_rxbuf_alloc(&sc->common, skb = ath_rxbuf_alloc(common,
sc->rxbufsize + sc->common.cachelsz - 1, sc->rxbufsize + common->cachelsz - 1,
GFP_ATOMIC); GFP_ATOMIC);
if (!skb) { if (!skb) {
ATH5K_ERR(sc, "can't alloc skbuff of size %u\n", ATH5K_ERR(sc, "can't alloc skbuff of size %u\n",
sc->rxbufsize + sc->common.cachelsz - 1); sc->rxbufsize + common->cachelsz - 1);
return NULL; return NULL;
} }
...@@ -1606,13 +1610,14 @@ static int ...@@ -1606,13 +1610,14 @@ static int
ath5k_rx_start(struct ath5k_softc *sc) ath5k_rx_start(struct ath5k_softc *sc)
{ {
struct ath5k_hw *ah = sc->ah; struct ath5k_hw *ah = sc->ah;
struct ath_common *common = ath5k_hw_common(ah);
struct ath5k_buf *bf; struct ath5k_buf *bf;
int ret; int ret;
sc->rxbufsize = roundup(IEEE80211_MAX_LEN, sc->common.cachelsz); sc->rxbufsize = roundup(IEEE80211_MAX_LEN, common->cachelsz);
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n", ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n",
sc->common.cachelsz, sc->rxbufsize); common->cachelsz, sc->rxbufsize);
spin_lock_bh(&sc->rxbuflock); spin_lock_bh(&sc->rxbuflock);
sc->rxlink = NULL; sc->rxlink = NULL;
......
...@@ -115,7 +115,6 @@ struct ath5k_rfkill { ...@@ -115,7 +115,6 @@ struct ath5k_rfkill {
* associated with an instance of a device */ * associated with an instance of a device */
struct ath5k_softc { struct ath5k_softc {
struct pci_dev *pdev; /* for dma mapping */ struct pci_dev *pdev; /* for dma mapping */
struct ath_common common;
void __iomem *iobase; /* address of the device */ void __iomem *iobase; /* address of the device */
struct mutex lock; /* dev-level lock */ struct mutex lock; /* dev-level lock */
struct ieee80211_tx_queue_stats tx_stats[AR5K_NUM_TX_QUEUES]; struct ieee80211_tx_queue_stats tx_stats[AR5K_NUM_TX_QUEUES];
...@@ -204,7 +203,7 @@ struct ath5k_softc { ...@@ -204,7 +203,7 @@ struct ath5k_softc {
static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah) static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
{ {
return &ah->ah_sc->common; return &ah->common;
} }
static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah) static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment