aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2010-10-28 15:46:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-11-15 13:25:21 -0500
commit71125abdf0c297adc00dc5632f0318b2397286f5 (patch)
treee24ed86199b36e97365b83ed855390f99cb12073
parentf8d9802f66eda9ff14f7667f99a46b31e9a9e273 (diff)
wl1271: set wl->vif only if add_interface succeeded.
set wl->vif to the newly created interface only after the firmware booted successfully. on the way - make the function flow more clear. Signed-off-by: Eliad Peller <eliad@wizery.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index c54887c80646..a3a1ebc578a3 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -950,18 +950,19 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
950 struct wiphy *wiphy = hw->wiphy; 950 struct wiphy *wiphy = hw->wiphy;
951 int retries = WL1271_BOOT_RETRIES; 951 int retries = WL1271_BOOT_RETRIES;
952 int ret = 0; 952 int ret = 0;
953 bool booted = false;
953 954
954 wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", 955 wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM",
955 vif->type, vif->addr); 956 vif->type, vif->addr);
956 957
957 mutex_lock(&wl->mutex); 958 mutex_lock(&wl->mutex);
958 if (wl->vif) { 959 if (wl->vif) {
960 wl1271_debug(DEBUG_MAC80211,
961 "multiple vifs are not supported yet");
959 ret = -EBUSY; 962 ret = -EBUSY;
960 goto out; 963 goto out;
961 } 964 }
962 965
963 wl->vif = vif;
964
965 switch (vif->type) { 966 switch (vif->type) {
966 case NL80211_IFTYPE_STATION: 967 case NL80211_IFTYPE_STATION:
967 wl->bss_type = BSS_TYPE_STA_BSS; 968 wl->bss_type = BSS_TYPE_STA_BSS;
@@ -999,15 +1000,8 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
999 if (ret < 0) 1000 if (ret < 0)
1000 goto irq_disable; 1001 goto irq_disable;
1001 1002
1002 wl->state = WL1271_STATE_ON; 1003 booted = true;
1003 wl1271_info("firmware booted (%s)", wl->chip.fw_ver); 1004 break;
1004
1005 /* update hw/fw version info in wiphy struct */
1006 wiphy->hw_version = wl->chip.id;
1007 strncpy(wiphy->fw_version, wl->chip.fw_ver,
1008 sizeof(wiphy->fw_version));
1009
1010 goto out;
1011 1005
1012irq_disable: 1006irq_disable:
1013 wl1271_disable_interrupts(wl); 1007 wl1271_disable_interrupts(wl);
@@ -1025,8 +1019,21 @@ power_off:
1025 wl1271_power_off(wl); 1019 wl1271_power_off(wl);
1026 } 1020 }
1027 1021
1028 wl1271_error("firmware boot failed despite %d retries", 1022 if (!booted) {
1029 WL1271_BOOT_RETRIES); 1023 wl1271_error("firmware boot failed despite %d retries",
1024 WL1271_BOOT_RETRIES);
1025 goto out;
1026 }
1027
1028 wl->vif = vif;
1029 wl->state = WL1271_STATE_ON;
1030 wl1271_info("firmware booted (%s)", wl->chip.fw_ver);
1031
1032 /* update hw/fw version info in wiphy struct */
1033 wiphy->hw_version = wl->chip.id;
1034 strncpy(wiphy->fw_version, wl->chip.fw_ver,
1035 sizeof(wiphy->fw_version));
1036
1030out: 1037out:
1031 mutex_unlock(&wl->mutex); 1038 mutex_unlock(&wl->mutex);
1032 1039