cfg80211: add generic helper to check interface is running

Add a helper using wdev to check if interface is running. This
deals with both non-netdev and netdev interfaces. In struct
wireless_dev replace 'p2p_started' and 'nan_started' by
'is_running' as those are mutually exclusive anyway, and unify
all the code to use wdev_running().

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Arend Van Spriel 2016-10-20 20:08:22 +01:00 committed by Johannes Berg
parent 8f20542386
commit 73c7da3dae
3 changed files with 31 additions and 45 deletions

View file

@ -210,11 +210,11 @@ void cfg80211_stop_p2p_device(struct cfg80211_registered_device *rdev,
if (WARN_ON(wdev->iftype != NL80211_IFTYPE_P2P_DEVICE))
return;
if (!wdev->p2p_started)
if (!wdev_running(wdev))
return;
rdev_stop_p2p_device(rdev, wdev);
wdev->p2p_started = false;
wdev->is_running = false;
rdev->opencount--;
@ -233,11 +233,11 @@ void cfg80211_stop_nan(struct cfg80211_registered_device *rdev,
if (WARN_ON(wdev->iftype != NL80211_IFTYPE_NAN))
return;
if (!wdev->nan_started)
if (!wdev_running(wdev))
return;
rdev_stop_nan(rdev, wdev);
wdev->nan_started = false;
wdev->is_running = false;
rdev->opencount--;
}