Commit 306b79ea authored by Johannes Berg's avatar Johannes Berg

nl80211: clarify code in nl80211_del_station()

The long if chain of interface types is hard to read,
especially now with the additional condition after it.
Use a switch statement to clarify this code.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20200320113834.2c51b9e8e341.I3fa5dc3f7d3cb1dbbd77191d764586f7da993f3f@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 7fc82af8
...@@ -6285,16 +6285,22 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) ...@@ -6285,16 +6285,22 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_MAC]) if (info->attrs[NL80211_ATTR_MAC])
params.mac = nla_data(info->attrs[NL80211_ATTR_MAC]); params.mac = nla_data(info->attrs[NL80211_ATTR_MAC]);
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && switch (dev->ieee80211_ptr->iftype) {
dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && case NL80211_IFTYPE_AP:
dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && case NL80211_IFTYPE_AP_VLAN:
dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO && case NL80211_IFTYPE_MESH_POINT:
dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) case NL80211_IFTYPE_P2P_GO:
return -EINVAL; /* always accept these */
if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_ADHOC && break;
!wiphy_ext_feature_isset(&rdev->wiphy, case NL80211_IFTYPE_ADHOC:
/* conditionally accept */
if (wiphy_ext_feature_isset(&rdev->wiphy,
NL80211_EXT_FEATURE_DEL_IBSS_STA)) NL80211_EXT_FEATURE_DEL_IBSS_STA))
break;
return -EINVAL;
default:
return -EINVAL; return -EINVAL;
}
if (!rdev->ops->del_station) if (!rdev->ops->del_station)
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment