* [PATCH v2] wl1271: set wl->vif only if add_interface succeeded.
@ 2010-10-28 19:46 Eliad Peller
2010-11-01 19:23 ` Luciano Coelho
0 siblings, 1 reply; 2+ messages in thread
From: Eliad Peller @ 2010-10-28 19:46 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless
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>
---
v1->v2:
use wl1271_debug instead of wl1271_error
drivers/net/wireless/wl12xx/wl1271_main.c | 33 +++++++++++++++++-----------
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 c54887c..a3a1ebc 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,
struct wiphy *wiphy = hw->wiphy;
int retries = WL1271_BOOT_RETRIES;
int ret = 0;
+ bool booted = false;
wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM",
vif->type, vif->addr);
mutex_lock(&wl->mutex);
if (wl->vif) {
+ wl1271_debug(DEBUG_MAC80211,
+ "multiple vifs are not supported yet");
ret = -EBUSY;
goto out;
}
- wl->vif = vif;
-
switch (vif->type) {
case NL80211_IFTYPE_STATION:
wl->bss_type = BSS_TYPE_STA_BSS;
@@ -999,15 +1000,8 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
if (ret < 0)
goto irq_disable;
- wl->state = WL1271_STATE_ON;
- wl1271_info("firmware booted (%s)", wl->chip.fw_ver);
-
- /* update hw/fw version info in wiphy struct */
- wiphy->hw_version = wl->chip.id;
- strncpy(wiphy->fw_version, wl->chip.fw_ver,
- sizeof(wiphy->fw_version));
-
- goto out;
+ booted = true;
+ break;
irq_disable:
wl1271_disable_interrupts(wl);
@@ -1025,8 +1019,21 @@ power_off:
wl1271_power_off(wl);
}
- wl1271_error("firmware boot failed despite %d retries",
- WL1271_BOOT_RETRIES);
+ if (!booted) {
+ wl1271_error("firmware boot failed despite %d retries",
+ WL1271_BOOT_RETRIES);
+ goto out;
+ }
+
+ wl->vif = vif;
+ wl->state = WL1271_STATE_ON;
+ wl1271_info("firmware booted (%s)", wl->chip.fw_ver);
+
+ /* update hw/fw version info in wiphy struct */
+ wiphy->hw_version = wl->chip.id;
+ strncpy(wiphy->fw_version, wl->chip.fw_ver,
+ sizeof(wiphy->fw_version));
+
out:
mutex_unlock(&wl->mutex);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] wl1271: set wl->vif only if add_interface succeeded.
2010-10-28 19:46 [PATCH v2] wl1271: set wl->vif only if add_interface succeeded Eliad Peller
@ 2010-11-01 19:23 ` Luciano Coelho
0 siblings, 0 replies; 2+ messages in thread
From: Luciano Coelho @ 2010-11-01 19:23 UTC (permalink / raw)
To: ext Eliad Peller; +Cc: linux-wireless@vger.kernel.org
On Thu, 2010-10-28 at 21:46 +0200, ext Eliad Peller wrote:
> 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>
> ---
Applied, thank you!
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-01 19:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28 19:46 [PATCH v2] wl1271: set wl->vif only if add_interface succeeded Eliad Peller
2010-11-01 19:23 ` Luciano Coelho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).