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>
This commit is contained in:

committed by
John W. Linville

parent
491735929b
commit
e0d687bd9d
@@ -11,7 +11,7 @@ static ssize_t ath5k_attr_show_##name(struct device *dev, \
|
||||
char *buf) \
|
||||
{ \
|
||||
struct ieee80211_hw *hw = dev_get_drvdata(dev); \
|
||||
struct ath5k_softc *sc = hw->priv; \
|
||||
struct ath5k_hw *ah = hw->priv; \
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", get); \
|
||||
} \
|
||||
\
|
||||
@@ -20,13 +20,13 @@ static ssize_t ath5k_attr_store_##name(struct device *dev, \
|
||||
const char *buf, size_t count) \
|
||||
{ \
|
||||
struct ieee80211_hw *hw = dev_get_drvdata(dev); \
|
||||
struct ath5k_softc *sc = hw->priv; \
|
||||
struct ath5k_hw *ah = hw->priv; \
|
||||
int val, ret; \
|
||||
\
|
||||
ret = kstrtoint(buf, 10, &val); \
|
||||
if (ret < 0) \
|
||||
return ret; \
|
||||
set(sc->ah, val); \
|
||||
set(ah, val); \
|
||||
return count; \
|
||||
} \
|
||||
static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, \
|
||||
@@ -38,25 +38,25 @@ static ssize_t ath5k_attr_show_##name(struct device *dev, \
|
||||
char *buf) \
|
||||
{ \
|
||||
struct ieee80211_hw *hw = dev_get_drvdata(dev); \
|
||||
struct ath5k_softc *sc = hw->priv; \
|
||||
struct ath5k_hw *ah = hw->priv; \
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", get); \
|
||||
} \
|
||||
static DEVICE_ATTR(name, S_IRUGO, ath5k_attr_show_##name, NULL)
|
||||
|
||||
/*** ANI ***/
|
||||
|
||||
SIMPLE_SHOW_STORE(ani_mode, sc->ani_state.ani_mode, ath5k_ani_init);
|
||||
SIMPLE_SHOW_STORE(noise_immunity_level, sc->ani_state.noise_imm_level,
|
||||
SIMPLE_SHOW_STORE(ani_mode, ah->ani_state.ani_mode, ath5k_ani_init);
|
||||
SIMPLE_SHOW_STORE(noise_immunity_level, ah->ani_state.noise_imm_level,
|
||||
ath5k_ani_set_noise_immunity_level);
|
||||
SIMPLE_SHOW_STORE(spur_level, sc->ani_state.spur_level,
|
||||
SIMPLE_SHOW_STORE(spur_level, ah->ani_state.spur_level,
|
||||
ath5k_ani_set_spur_immunity_level);
|
||||
SIMPLE_SHOW_STORE(firstep_level, sc->ani_state.firstep_level,
|
||||
SIMPLE_SHOW_STORE(firstep_level, ah->ani_state.firstep_level,
|
||||
ath5k_ani_set_firstep_level);
|
||||
SIMPLE_SHOW_STORE(ofdm_weak_signal_detection, sc->ani_state.ofdm_weak_sig,
|
||||
SIMPLE_SHOW_STORE(ofdm_weak_signal_detection, ah->ani_state.ofdm_weak_sig,
|
||||
ath5k_ani_set_ofdm_weak_signal_detection);
|
||||
SIMPLE_SHOW_STORE(cck_weak_signal_detection, sc->ani_state.cck_weak_sig,
|
||||
SIMPLE_SHOW_STORE(cck_weak_signal_detection, ah->ani_state.cck_weak_sig,
|
||||
ath5k_ani_set_cck_weak_signal_detection);
|
||||
SIMPLE_SHOW(spur_level_max, sc->ani_state.max_spur_level);
|
||||
SIMPLE_SHOW(spur_level_max, ah->ani_state.max_spur_level);
|
||||
|
||||
static ssize_t ath5k_attr_show_noise_immunity_level_max(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
@@ -98,14 +98,14 @@ static struct attribute_group ath5k_attribute_group_ani = {
|
||||
/*** register / unregister ***/
|
||||
|
||||
int
|
||||
ath5k_sysfs_register(struct ath5k_softc *sc)
|
||||
ath5k_sysfs_register(struct ath5k_hw *ah)
|
||||
{
|
||||
struct device *dev = sc->dev;
|
||||
struct device *dev = ah->dev;
|
||||
int err;
|
||||
|
||||
err = sysfs_create_group(&dev->kobj, &ath5k_attribute_group_ani);
|
||||
if (err) {
|
||||
ATH5K_ERR(sc, "failed to create sysfs group\n");
|
||||
ATH5K_ERR(ah, "failed to create sysfs group\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -113,9 +113,9 @@ ath5k_sysfs_register(struct ath5k_softc *sc)
|
||||
}
|
||||
|
||||
void
|
||||
ath5k_sysfs_unregister(struct ath5k_softc *sc)
|
||||
ath5k_sysfs_unregister(struct ath5k_hw *ah)
|
||||
{
|
||||
struct device *dev = sc->dev;
|
||||
struct device *dev = ah->dev;
|
||||
|
||||
sysfs_remove_group(&dev->kobj, &ath5k_attribute_group_ani);
|
||||
}
|
||||
|
Reference in New Issue
Block a user