aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/base.c
diff options
context:
space:
mode:
authorBob Copeland <me@bobcopeland.com>2008-11-17 23:40:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-26 09:47:35 -0500
commit0e149cf5a1b1900484f4b808d59a5f246cd720be (patch)
tree1392d353012242c9fc313ae67b881a8dccb9040c /drivers/net/wireless/ath5k/base.c
parent8f93b8b337763a58fcdf23333ffe752db6c93bae (diff)
ath5k: set mac address in add_interface
Configure the mac address in add_interface and clear it in remove_interface so that users can change the mac address to something other than the one in the eeprom. Also avoid setting it at attach time so that we won't ack packets until fully set up. Signed-off-by: Bob Copeland <me@bobcopeland.com> 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.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 7fdb59c813ca..4bcea5a9d70b 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -707,7 +707,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
707{ 707{
708 struct ath5k_softc *sc = hw->priv; 708 struct ath5k_softc *sc = hw->priv;
709 struct ath5k_hw *ah = sc->ah; 709 struct ath5k_hw *ah = sc->ah;
710 u8 mac[ETH_ALEN]; 710 u8 mac[ETH_ALEN] = {};
711 int ret; 711 int ret;
712 712
713 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device); 713 ATH5K_DBG(sc, ATH5K_DEBUG_ANY, "devid 0x%x\n", pdev->device);
@@ -777,7 +777,13 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
777 tasklet_init(&sc->restq, ath5k_tasklet_reset, (unsigned long)sc); 777 tasklet_init(&sc->restq, ath5k_tasklet_reset, (unsigned long)sc);
778 setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc); 778 setup_timer(&sc->calib_tim, ath5k_calibrate, (unsigned long)sc);
779 779
780 ath5k_hw_get_lladdr(ah, mac); 780 ret = ath5k_eeprom_read_mac(ah, mac);
781 if (ret) {
782 ATH5K_ERR(sc, "unable to read address from EEPROM: 0x%04x\n",
783 sc->pdev->device);
784 goto err_queues;
785 }
786
781 SET_IEEE80211_PERM_ADDR(hw, mac); 787 SET_IEEE80211_PERM_ADDR(hw, mac);
782 /* All MAC address bits matter for ACKs */ 788 /* All MAC address bits matter for ACKs */
783 memset(sc->bssidmask, 0xff, ETH_ALEN); 789 memset(sc->bssidmask, 0xff, ETH_ALEN);
@@ -2765,6 +2771,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw,
2765 /* Set to a reasonable value. Note that this will 2771 /* Set to a reasonable value. Note that this will
2766 * be set to mac80211's value at ath5k_config(). */ 2772 * be set to mac80211's value at ath5k_config(). */
2767 sc->bintval = 1000; 2773 sc->bintval = 1000;
2774 ath5k_hw_set_lladdr(sc->ah, conf->mac_addr);
2768 2775
2769 ret = 0; 2776 ret = 0;
2770end: 2777end:
@@ -2777,11 +2784,13 @@ ath5k_remove_interface(struct ieee80211_hw *hw,
2777 struct ieee80211_if_init_conf *conf) 2784 struct ieee80211_if_init_conf *conf)
2778{ 2785{
2779 struct ath5k_softc *sc = hw->priv; 2786 struct ath5k_softc *sc = hw->priv;
2787 u8 mac[ETH_ALEN] = {};
2780 2788
2781 mutex_lock(&sc->lock); 2789 mutex_lock(&sc->lock);
2782 if (sc->vif != conf->vif) 2790 if (sc->vif != conf->vif)
2783 goto end; 2791 goto end;
2784 2792
2793 ath5k_hw_set_lladdr(sc->ah, mac);
2785 sc->vif = NULL; 2794 sc->vif = NULL;
2786end: 2795end:
2787 mutex_unlock(&sc->lock); 2796 mutex_unlock(&sc->lock);