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
+10 -3
View File
@@ -3781,8 +3781,8 @@ struct cfg80211_cached_keys;
* @beacon_interval: beacon interval used on this device for transmitting
* beacons, 0 when not valid
* @address: The address for this device, valid only if @netdev is %NULL
* @p2p_started: true if this is a P2P Device that has been started
* @nan_started: true if this is a NAN interface that has been started
* @is_running: true if this is a non-netdev device that has been started, e.g.
* the P2P Device.
* @cac_started: true if DFS channel availability check has been started
* @cac_start_time: timestamp (jiffies) when the dfs state was entered.
* @cac_time_ms: CAC time in ms
@@ -3814,7 +3814,7 @@ struct wireless_dev {
struct mutex mtx;
bool use_4addr, p2p_started, nan_started;
bool use_4addr, is_running;
u8 address[ETH_ALEN] __aligned(sizeof(u16));
@@ -3871,6 +3871,13 @@ static inline u8 *wdev_address(struct wireless_dev *wdev)
return wdev->address;
}
static inline bool wdev_running(struct wireless_dev *wdev)
{
if (wdev->netdev)
return netif_running(wdev->netdev);
return wdev->is_running;
}
/**
* wdev_priv - return wiphy priv from wireless_dev
*