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

scan: Refactor scan result fetching to scan.c

No functionality changes by this commit.
This commit is contained in:
Jukka Rissanen 2015-01-12 17:52:39 +02:00 committed by Denis Kenzior
parent f73708e1d7
commit cb78798857
3 changed files with 19 additions and 12 deletions

View File

@ -67,3 +67,15 @@ void scan_sched_start(struct l_genl_family *nl80211, uint32_t ifindex,
l_genl_msg_unref(msg);
}
void scan_get_results(struct l_genl_family *nl80211, uint32_t ifindex,
scan_func_t callback, scan_done_func_t scan_done,
void *user_data)
{
struct l_genl_msg *msg;
msg = l_genl_msg_new_sized(NL80211_CMD_GET_SCAN, 8);
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &ifindex);
l_genl_family_dump(nl80211, msg, callback, user_data, scan_done);
l_genl_msg_unref(msg);
}

View File

@ -21,6 +21,7 @@
*/
typedef void (*scan_func_t)(struct l_genl_msg *msg, void *user_data);
typedef void (*scan_done_func_t)(void *user_data);
void scan_start(struct l_genl_family *nl80211, uint32_t ifindex,
scan_func_t callback, void *user_data);
@ -28,3 +29,7 @@ void scan_start(struct l_genl_family *nl80211, uint32_t ifindex,
void scan_sched_start(struct l_genl_family *nl80211, uint32_t ifindex,
uint32_t scan_interval, scan_func_t callback,
void *user_data);
void scan_get_results(struct l_genl_family *nl80211, uint32_t ifindex,
scan_func_t callback, scan_done_func_t scan_done,
void *user_data);

View File

@ -731,17 +731,6 @@ static void get_scan_done(void *user)
netdev->old_bss_list = NULL;
}
static void get_scan(struct netdev *netdev)
{
struct l_genl_msg *msg;
msg = l_genl_msg_new_sized(NL80211_CMD_GET_SCAN, 8);
msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &netdev->index);
l_genl_family_dump(nl80211, msg, get_scan_callback, netdev,
get_scan_done);
l_genl_msg_unref(msg);
}
static void sched_scan_callback(struct l_genl_msg *msg, void *user_data)
{
struct l_genl_attr attr;
@ -1088,7 +1077,8 @@ static void wiphy_scan_notify(struct l_genl_msg *msg, void *user_data)
if (cmd == NL80211_CMD_NEW_SCAN_RESULTS ||
cmd == NL80211_CMD_SCHED_SCAN_RESULTS) {
get_scan(netdev);
scan_get_results(nl80211, netdev->index, get_scan_callback,
get_scan_done, netdev);
return;
}
}