Skip to content

Commit e0d687b

Browse files
Pavel Roskinlinvjw
authored andcommitted
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>
1 parent 4917359 commit e0d687b

22 files changed

Lines changed: 1247 additions & 1314 deletions

File tree

‎drivers/net/wireless/ath/ath5k/ahb.c‎

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
3535
static bool
3636
ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
3737
{
38-
struct ath5k_softc *sc = common->priv;
39-
struct platform_device *pdev = to_platform_device(sc->dev);
38+
struct ath5k_hw *ah = common->priv;
39+
struct platform_device *pdev = to_platform_device(ah->dev);
4040
struct ar231x_board_config *bcfg = pdev->dev.platform_data;
4141
u16 *eeprom, *eeprom_end;
4242

@@ -56,21 +56,19 @@ ath5k_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)
5656

5757
int ath5k_hw_read_srev(struct ath5k_hw *ah)
5858
{
59-
struct ath5k_softc *sc = ah->ah_sc;
60-
struct platform_device *pdev = to_platform_device(sc->dev);
59+
struct platform_device *pdev = to_platform_device(ah->dev);
6160
struct ar231x_board_config *bcfg = pdev->dev.platform_data;
6261
ah->ah_mac_srev = bcfg->devid;
6362
return 0;
6463
}
6564

6665
static int ath5k_ahb_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
6766
{
68-
struct ath5k_softc *sc = ah->ah_sc;
69-
struct platform_device *pdev = to_platform_device(sc->dev);
67+
struct platform_device *pdev = to_platform_device(ah->dev);
7068
struct ar231x_board_config *bcfg = pdev->dev.platform_data;
7169
u8 *cfg_mac;
7270

73-
if (to_platform_device(sc->dev)->id == 0)
71+
if (to_platform_device(ah->dev)->id == 0)
7472
cfg_mac = bcfg->config->wlan0_mac;
7573
else
7674
cfg_mac = bcfg->config->wlan1_mac;
@@ -90,7 +88,7 @@ static const struct ath_bus_ops ath_ahb_bus_ops = {
9088
static int ath_ahb_probe(struct platform_device *pdev)
9189
{
9290
struct ar231x_board_config *bcfg = pdev->dev.platform_data;
93-
struct ath5k_softc *sc;
91+
struct ath5k_hw *ah;
9492
struct ieee80211_hw *hw;
9593
struct resource *res;
9694
void __iomem *mem;
@@ -127,19 +125,19 @@ static int ath_ahb_probe(struct platform_device *pdev)
127125

128126
irq = res->start;
129127

130-
hw = ieee80211_alloc_hw(sizeof(struct ath5k_softc), &ath5k_hw_ops);
128+
hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
131129
if (hw == NULL) {
132130
dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
133131
ret = -ENOMEM;
134132
goto err_out;
135133
}
136134

137-
sc = hw->priv;
138-
sc->hw = hw;
139-
sc->dev = &pdev->dev;
140-
sc->iobase = mem;
141-
sc->irq = irq;
142-
sc->devid = bcfg->devid;
135+
ah = hw->priv;
136+
ah->hw = hw;
137+
ah->dev = &pdev->dev;
138+
ah->iobase = mem;
139+
ah->irq = irq;
140+
ah->devid = bcfg->devid;
143141

144142
if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
145143
/* Enable WMAC AHB arbitration */
@@ -155,7 +153,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
155153
/* Enable WMAC DMA access (assuming 5312 or 231x*/
156154
/* TODO: check other platforms */
157155
reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE);
158-
if (to_platform_device(sc->dev)->id == 0)
156+
if (to_platform_device(ah->dev)->id == 0)
159157
reg |= AR5K_AR5312_ENABLE_WLAN0;
160158
else
161159
reg |= AR5K_AR5312_ENABLE_WLAN1;
@@ -166,13 +164,13 @@ static int ath_ahb_probe(struct platform_device *pdev)
166164
* used as pass-through. Disable 2 GHz support in the
167165
* driver for it
168166
*/
169-
if (to_platform_device(sc->dev)->id == 0 &&
167+
if (to_platform_device(ah->dev)->id == 0 &&
170168
(bcfg->config->flags & (BD_WLAN0 | BD_WLAN1)) ==
171169
(BD_WLAN1 | BD_WLAN0))
172-
__set_bit(ATH_STAT_2G_DISABLED, sc->status);
170+
__set_bit(ATH_STAT_2G_DISABLED, ah->status);
173171
}
174172

175-
ret = ath5k_init_softc(sc, &ath_ahb_bus_ops);
173+
ret = ath5k_init_softc(ah, &ath_ahb_bus_ops);
176174
if (ret != 0) {
177175
dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
178176
ret = -ENODEV;
@@ -194,13 +192,13 @@ static int ath_ahb_remove(struct platform_device *pdev)
194192
{
195193
struct ar231x_board_config *bcfg = pdev->dev.platform_data;
196194
struct ieee80211_hw *hw = platform_get_drvdata(pdev);
197-
struct ath5k_softc *sc;
195+
struct ath5k_hw *ah;
198196
u32 reg;
199197

200198
if (!hw)
201199
return 0;
202200

203-
sc = hw->priv;
201+
ah = hw->priv;
204202

205203
if (bcfg->devid >= AR5K_SREV_AR2315_R6) {
206204
/* Disable WMAC AHB arbitration */
@@ -210,14 +208,14 @@ static int ath_ahb_remove(struct platform_device *pdev)
210208
} else {
211209
/*Stop DMA access */
212210
reg = __raw_readl((void __iomem *) AR5K_AR5312_ENABLE);
213-
if (to_platform_device(sc->dev)->id == 0)
211+
if (to_platform_device(ah->dev)->id == 0)
214212
reg &= ~AR5K_AR5312_ENABLE_WLAN0;
215213
else
216214
reg &= ~AR5K_AR5312_ENABLE_WLAN1;
217215
__raw_writel(reg, (void __iomem *) AR5K_AR5312_ENABLE);
218216
}
219217

220-
ath5k_deinit_softc(sc);
218+
ath5k_deinit_softc(ah);
221219
platform_set_drvdata(pdev, NULL);
222220
ieee80211_free_hw(hw);
223221

0 commit comments

Comments
 (0)