summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cfg.c
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2011-10-14 12:05:26 +0100
committerJohn W. Linville <linville@tuxdriver.com>2011-10-14 14:48:24 -0400
commit5c1381ac3f3f49ab1e0886ea8f1432c9a5def519 (patch)
tree8a7defc05a6eac854432449e0f452df26c70d935 /drivers/net/wireless/libertas/cfg.c
parent7a72476766735c57bc00d655770f8f21f232f482 (diff)
downloadlinux-5c1381ac3f3f49ab1e0886ea8f1432c9a5def519.tar.gz
linux-5c1381ac3f3f49ab1e0886ea8f1432c9a5def519.tar.bz2
linux-5c1381ac3f3f49ab1e0886ea8f1432c9a5def519.zip
libertas: fix changing interface type when interface is down
The recent changes to only power the device when the interface up introduced a bug: changing interface type, legal when the interface is down, performs device I/O. Fix this functionality by validating and recording the interface type when the change is requested, but only applying the change if/when the interface is brought up. Signed-off-by: Daniel Drake <dsd@laptop.org> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cfg.c')
-rw-r--r--drivers/net/wireless/libertas/cfg.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 610bfcee3cf6..ff6378276ff0 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -1666,28 +1666,20 @@ static int lbs_change_intf(struct wiphy *wiphy, struct net_device *dev,
if (dev == priv->mesh_dev)
return -EOPNOTSUPP;
- lbs_deb_enter(LBS_DEB_CFG80211);
-
switch (type) {
case NL80211_IFTYPE_MONITOR:
- ret = lbs_set_monitor_mode(priv, 1);
- break;
case NL80211_IFTYPE_STATION:
- if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR)
- ret = lbs_set_monitor_mode(priv, 0);
- if (!ret)
- ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 1);
- break;
case NL80211_IFTYPE_ADHOC:
- if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR)
- ret = lbs_set_monitor_mode(priv, 0);
- if (!ret)
- ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, 2);
break;
default:
- ret = -ENOTSUPP;
+ return -EOPNOTSUPP;
}
+ lbs_deb_enter(LBS_DEB_CFG80211);
+
+ if (priv->iface_running)
+ ret = lbs_set_iface_type(priv, type);
+
if (!ret)
priv->wdev->iftype = type;