From: Jim C. <jim...@gm...> - 2012-05-19 07:38:19
|
In acx_compat.h, add kernel-version dependent macros (2.6.34) which define ieee80211_VIF as ieee80211_vif or ieee80211_if_init_conf, and accessor macros for vif and addr fields. Use them to declutter acx_op_(add|remove)_interface(), and function bodies. Change include order in acx.h so that acx_compat.h can use CONFIG_ACX_MAC80211_VERSION defined in acx_func.h This reworks commit 8ebaf7dc, which was both bold and sloppy, and required a fixup commit cd12434adb. Hopefully I got it right this time. Signed-off-by: Jim Cromie <jim...@gm...> --- acx.h | 2 +- acx_compat.h | 21 +++++++++++++++------ common.c | 19 +++++-------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/acx.h b/acx.h index 5f764a8..d96f123 100644 --- a/acx.h +++ b/acx.h @@ -23,10 +23,10 @@ * #define CONFIG_PM 0 // in include/generated/autoconf.h */ -#include "acx_compat.h" #include "acx_config.h" #include "acx_struct_hw.h" #include "acx_struct_dev.h" #include "acx_func.h" +#include "acx_compat.h" #endif /* _ACX_H_ */ diff --git a/acx_compat.h b/acx_compat.h index b9f73b3..3caacba 100644 --- a/acx_compat.h +++ b/acx_compat.h @@ -29,11 +29,20 @@ do { \ #include <generated/utsrelease.h> #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) +#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(2, 6, 34) /* - Unsure about this one, its rather unselective. - Done to fix up acx_op_add_interface(..) in main code, - leaning towards mainline. TBD -*/ -# define ieee80211_vif ieee80211_if_init_conf + * v2.6.34 added ieee80211_vif, and obsoleted ieee80211_if_init_conf. + * To declutter acx_op_(add|remove)_interface(..), define macros to + * hide this struct change, naming them close to new one. This is + * surely not a solution for every conceivable _vif situation (the new + * struct surely holds a different set of fields), but is sufficient + * here. + */ +# define ieee80211_VIF ieee80211_if_init_conf +# define VIF_vif(vif) vif->vif +# define VIF_addr(vif) vif->mac_addr +#else +# define ieee80211_VIF ieee80211_vif +# define VIF_vif(vif) vif +# define VIF_addr(vif) vif->addr #endif diff --git a/common.c b/common.c index 6d90d3f..ed143e4 100644 --- a/common.c +++ b/common.c @@ -6238,7 +6238,7 @@ end: int acx_debugfs_add_adev(struct acx_device *adev); void acx_debugfs_remove_adev(struct acx_device *adev); -int acx_op_add_interface(struct ieee80211_hw *ieee, struct ieee80211_vif *vif) +int acx_op_add_interface(struct ieee80211_hw *ieee, struct ieee80211_VIF *vif) { acx_device_t *adev = ieee2adev(ieee); int err = -EOPNOTSUPP; @@ -6261,13 +6261,8 @@ int acx_op_add_interface(struct ieee80211_hw *ieee, struct ieee80211_vif *vif) goto out_unlock; adev->vif_operating = 1; -#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(2, 6, 34) - adev->vif = vif->vif; - mac_vif = vif->mac_addr; -#else - adev->vif = vif; - mac_vif = vif->addr; -#endif + adev->vif = VIF_vif(vif); + mac_vif = VIF_addr(vif); switch (adev->vif_type) { case NL80211_IFTYPE_AP: @@ -6321,7 +6316,7 @@ out_unlock: return err; } -void acx_op_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) +void acx_op_remove_interface(struct ieee80211_hw *hw, struct ieee80211_VIF *vif) { acx_device_t *adev = ieee2adev(hw); @@ -6332,11 +6327,7 @@ void acx_op_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) acx_sem_lock(adev); acx_debugfs_remove_adev(adev); -#if CONFIG_ACX_MAC80211_VERSION < KERNEL_VERSION(2, 6, 34) - mac_vif = vif->mac_addr; -#else - mac_vif = vif->addr; -#endif + mac_vif = VIF_addr(vif); if (vif->type == NL80211_IFTYPE_MONITOR) adev->vif_monitor--; -- 1.7.10.1.487.ga3935e6 |