diff options
author | Pavel Roskin <proski@gnu.org> | 2011-07-14 20:21:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-20 15:04:33 -0400 |
commit | e0d687bd9df218ba3d97aac15919d30816d72dcb (patch) | |
tree | 8a1a93dc7f940b4a0900aaa149725b535df17e25 /drivers/net/wireless/ath/ath5k/ahb.c | |
parent | 491735929b63cb665b2215e3183b960e66f221f3 (diff) | |
download | talos-obmc-linux-e0d687bd9df218ba3d97aac15919d30816d72dcb.tar.gz talos-obmc-linux-e0d687bd9df218ba3d97aac15919d30816d72dcb.zip |
ath5k: merge ath5k_hw and ath5k_softc
Both ath5k_hw and ath5k_softc represent one instance of the hardware.
This duplication is historical and is not needed anymore.
Keep the name "ath5k_hw" for the merged structure and "ah" for the
variable pointing to it. "ath5k_hw" is shorter than "ath5k_softc", more
descriptive and more widely used.
Put the combined structure to ath5k.h where the old ath5k_softc used to
be. Move some code from base.h to ath5k.h as needed.
Remove memory allocation for struct ath5k_hw and the corresponding error
handling. Merge iobase and ah_iobase fields.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/ahb.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ahb.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index ba682a0b2dd8..9f69a4c9a3f3 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c @@ -35,8 +35,8 @@ static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz) static bool ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) { - struct ath5k_softc *sc = common->priv; - struct platform_device *pdev = to_platform_device(sc->dev); + struct ath5k_hw *ah = common->priv; + struct platform_device *pdev = to_platform_device(ah->dev); struct ar231x_board_config *bcfg = pdev->dev.platform_data; u16 *eeprom, *eeprom_end; @@ -56,8 +56,7 @@ ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data) int ath5k_hw_read_srev(struct ath5k_hw *ah) { - struct ath5k_softc *sc = ah->ah_sc; - struct platform_device *pdev = to_platform_device(sc->dev); + struct platform_device *pdev = to_platform_device(ah->dev); struct ar231x_board_config *bcfg = pdev->dev.platform_data; ah->ah_mac_srev = bcfg->devid; return 0; @@ -65,12 +64,11 @@ int ath5k_hw_read_srev(struct ath5k_hw *ah) static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) { - struct ath5k_softc *sc = ah->ah_sc; - struct platform_device *pdev = to_platform_device(sc->dev); + struct platform_device *pdev = to_platform_device(ah->dev); struct ar231x_board_config *bcfg = pdev->dev.platform_data; u8 *cfg_mac; - if (to_platform_device(sc->dev)->id == 0) + if (to_platform_device(ah->dev)->id == 0) cfg_mac = bcfg->config->wlan0_mac; else cfg_mac = bcfg->config->wlan1_mac; @@ -90,7 +88,7 @@ static const struct ath_bus_ops ath_ahb_bus_ops = { static int ath_ahb_probe(struct platform_device *pdev) { struct ar231x_board_config *bcfg = pdev->dev.platform_data; - struct ath5k_softc *sc; + struct ath5k_hw *ah; struct ieee80211_hw *hw; struct resource *res; void __iomem *mem; @@ -127,19 +125,19 @@ static int ath_ahb_probe(struct platform_device *pdev) irq = res->start; - hw = ieee80211_alloc_hw(sizeof(struct ath5k_softc), &ath5k_hw_ops); + hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops); if (hw == NULL) { dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); ret = -ENOMEM; goto err_out; } - sc = hw->priv; - sc->hw = hw; - sc->dev = &pdev->dev; - sc->iobase = mem; - sc->irq = irq; - sc->devid = bcfg->devid; + ah = hw->priv; + ah->hw = hw; + ah->dev = &pdev->dev; + ah->iobase = mem; + ah->irq = irq; + ah->devid = bcfg->devid; if (bcfg->devid >= AR5K_SREV_AR2315_R6) { /* Enable WMAC AHB arbitration */ @@ -155,7 +153,7 @@ static int ath_ahb_probe(struct platform_device *pdev) /* Enable WMAC DMA access (assuming 5312 or 231x*/ /* TODO: check other platforms */ reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); - if (to_platform_device(sc->dev)->id == 0) + if (to_platform_device(ah->dev)->id == 0) reg |= AR5K_AR5312_ENABLE_WLAN0; else reg |= AR5K_AR5312_ENABLE_WLAN1; @@ -166,13 +164,13 @@ static int ath_ahb_probe(struct platform_device *pdev) * used as pass-through. Disable 2 GHz support in the * driver for it */ - if (to_platform_device(sc->dev)->id == 0 && + if (to_platform_device(ah->dev)->id == 0 && (bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) == (BD_WLAN1 | BD_WLAN0)) - __set_bit(ATH_STAT_2G_DISABLED, sc->status); + __set_bit(ATH_STAT_2G_DISABLED, ah->status); } - ret = ath5k_init_softc(sc, &ath_ahb_bus_ops); + ret = ath5k_init_softc(ah, &ath_ahb_bus_ops); if (ret != 0) { dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret); ret = -ENODEV; @@ -194,13 +192,13 @@ static int ath_ahb_remove(struct platform_device *pdev) { struct ar231x_board_config *bcfg = pdev->dev.platform_data; struct ieee80211_hw *hw = platform_get_drvdata(pdev); - struct ath5k_softc *sc; + struct ath5k_hw *ah; u32 reg; if (!hw) return 0; - sc = hw->priv; + ah = hw->priv; if (bcfg->devid >= AR5K_SREV_AR2315_R6) { /* Disable WMAC AHB arbitration */ @@ -210,14 +208,14 @@ static int ath_ahb_remove(struct platform_device *pdev) } else { /*Stop DMA access */ reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE); - if (to_platform_device(sc->dev)->id == 0) + if (to_platform_device(ah->dev)->id == 0) reg &= ~AR5K_AR5312_ENABLE_WLAN0; else reg &= ~AR5K_AR5312_ENABLE_WLAN1; __raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE); } - ath5k_deinit_softc(sc); + ath5k_deinit_softc(ah); platform_set_drvdata(pdev, NULL); ieee80211_free_hw(hw); |