3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-18 10:19:24 +01:00

wiphy: Introduce wiphy_new

This commit is contained in:
Denis Kenzior 2018-11-29 11:22:07 -06:00
parent 52771de1a5
commit 9be982b460

View File

@ -57,15 +57,15 @@ struct wiphy {
uint32_t feature_flags; uint32_t feature_flags;
uint8_t ext_features[(NUM_NL80211_EXT_FEATURES + 7) / 8]; uint8_t ext_features[(NUM_NL80211_EXT_FEATURES + 7) / 8];
uint8_t max_num_ssids_per_scan; uint8_t max_num_ssids_per_scan;
bool support_scheduled_scan:1;
bool support_rekey_offload:1;
bool support_adhoc_rsn:1;
uint16_t supported_iftypes; uint16_t supported_iftypes;
uint16_t supported_ciphers; uint16_t supported_ciphers;
struct scan_freq_set *supported_freqs; struct scan_freq_set *supported_freqs;
char *model_str; char *model_str;
char *vendor_str; char *vendor_str;
bool support_scheduled_scan:1;
bool support_rekey_offload:1;
bool support_adhoc_rsn:1;
bool soft_rfkill : 1; bool soft_rfkill : 1;
bool hard_rfkill : 1; bool hard_rfkill : 1;
}; };
@ -148,6 +148,16 @@ enum ie_rsn_akm_suite wiphy_select_akm(struct wiphy *wiphy,
return 0; return 0;
} }
static struct wiphy *wiphy_new(uint32_t id)
{
struct wiphy *wiphy = l_new(struct wiphy, 1);
wiphy->id = id;
wiphy->supported_freqs = scan_freq_set_new();
return wiphy;
}
static void wiphy_free(void *data) static void wiphy_free(void *data)
{ {
struct wiphy *wiphy = data; struct wiphy *wiphy = data;
@ -622,9 +632,7 @@ static void wiphy_dump_callback(struct l_genl_msg *msg, void *user_data)
if (!wiphy_is_managed(name)) if (!wiphy_is_managed(name))
return; return;
wiphy = l_new(struct wiphy, 1); wiphy = wiphy_new(id);
wiphy->id = id;
wiphy->supported_freqs = scan_freq_set_new();
l_queue_push_head(wiphy_list, wiphy); l_queue_push_head(wiphy_list, wiphy);
} }
@ -734,10 +742,8 @@ static void wiphy_new_wiphy_event(struct l_genl_msg *msg)
if (!wiphy_is_managed(name)) if (!wiphy_is_managed(name))
return; return;
wiphy = l_new(struct wiphy, 1); wiphy = wiphy_new(id);
wiphy->id = id;
memcpy(wiphy->name, name, name_len); memcpy(wiphy->name, name, name_len);
wiphy->supported_freqs = scan_freq_set_new();
l_queue_push_head(wiphy_list, wiphy); l_queue_push_head(wiphy_list, wiphy);
wiphy_parse_attributes(wiphy, &attr); wiphy_parse_attributes(wiphy, &attr);