aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/base.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-12-18 19:31:26 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:36 -0500
commit32bfd35d4b63bd63de4bb0d791ef049c3c868726 (patch)
treec1c213a35a00bcbe71a2ecc6521e19dec66cf6eb /drivers/net/wireless/ath5k/base.c
parentf653211197f3841f383fa9757ef8ce182c6cf627 (diff)
mac80211: dont use interface indices in drivers
This patch gets rid of the if_id stuff where possible in favour of a new per-virtual-interface structure "struct ieee80211_vif". This structure is located at the end of the per-interface structure and contains a variable length driver-use data area. This has two advantages: * removes the need to look up interfaces by if_id, this is better for working with network namespaces and performance * allows drivers to store and retrieve per-interface data without having to allocate own lists/hash tables Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath5k/base.c')
-rw-r--r--drivers/net/wireless/ath5k/base.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index d3d37282f3d..742616a03d5 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -178,7 +178,8 @@ static void ath5k_remove_interface(struct ieee80211_hw *hw,
178 struct ieee80211_if_init_conf *conf); 178 struct ieee80211_if_init_conf *conf);
179static int ath5k_config(struct ieee80211_hw *hw, 179static int ath5k_config(struct ieee80211_hw *hw,
180 struct ieee80211_conf *conf); 180 struct ieee80211_conf *conf);
181static int ath5k_config_interface(struct ieee80211_hw *hw, int if_id, 181static int ath5k_config_interface(struct ieee80211_hw *hw,
182 struct ieee80211_vif *vif,
182 struct ieee80211_if_conf *conf); 183 struct ieee80211_if_conf *conf);
183static void ath5k_configure_filter(struct ieee80211_hw *hw, 184static void ath5k_configure_filter(struct ieee80211_hw *hw,
184 unsigned int changed_flags, 185 unsigned int changed_flags,
@@ -2498,12 +2499,12 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
2498 int ret; 2499 int ret;
2499 2500
2500 mutex_lock(&sc->lock); 2501 mutex_lock(&sc->lock);
2501 if (sc->iface_id) { 2502 if (sc->vif) {
2502 ret = 0; 2503 ret = 0;
2503 goto end; 2504 goto end;
2504 } 2505 }
2505 2506
2506 sc->iface_id = conf->if_id; 2507 sc->vif = conf->vif;
2507 2508
2508 switch (conf->type) { 2509 switch (conf->type) {
2509 case IEEE80211_IF_TYPE_STA: 2510 case IEEE80211_IF_TYPE_STA:
@@ -2528,10 +2529,10 @@ ath5k_remove_interface(struct ieee80211_hw *hw,
2528 struct ath5k_softc *sc = hw->priv; 2529 struct ath5k_softc *sc = hw->priv;
2529 2530
2530 mutex_lock(&sc->lock); 2531 mutex_lock(&sc->lock);
2531 if (sc->iface_id != conf->if_id) 2532 if (sc->vif != conf->vif)
2532 goto end; 2533 goto end;
2533 2534
2534 sc->iface_id = 0; 2535 sc->vif = NULL;
2535end: 2536end:
2536 mutex_unlock(&sc->lock); 2537 mutex_unlock(&sc->lock);
2537} 2538}
@@ -2549,7 +2550,7 @@ ath5k_config(struct ieee80211_hw *hw,
2549} 2550}
2550 2551
2551static int 2552static int
2552ath5k_config_interface(struct ieee80211_hw *hw, int if_id, 2553ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2553 struct ieee80211_if_conf *conf) 2554 struct ieee80211_if_conf *conf)
2554{ 2555{
2555 struct ath5k_softc *sc = hw->priv; 2556 struct ath5k_softc *sc = hw->priv;
@@ -2560,7 +2561,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, int if_id,
2560 * be set to mac80211's value at ath5k_config(). */ 2561 * be set to mac80211's value at ath5k_config(). */
2561 sc->bintval = 1000 * 1000 / 1024; 2562 sc->bintval = 1000 * 1000 / 1024;
2562 mutex_lock(&sc->lock); 2563 mutex_lock(&sc->lock);
2563 if (sc->iface_id != if_id) { 2564 if (sc->vif != vif) {
2564 ret = -EIO; 2565 ret = -EIO;
2565 goto unlock; 2566 goto unlock;
2566 } 2567 }