anqp: utilize IWD_MODULE

This converts anqp into an IWD module.
This commit is contained in:
James Prestwood 2019-10-11 12:29:25 -07:00 committed by Denis Kenzior
parent 369c5fbd0b
commit 2ab8d4bbed
3 changed files with 8 additions and 9 deletions

View File

@ -474,11 +474,11 @@ static void anqp_mlme_notify(struct l_genl_msg *msg, void *user_data)
}
}
bool anqp_init(struct l_genl_family *in)
static int anqp_init(void)
{
struct l_genl *genl = iwd_get_genl();
nl80211 = in;
nl80211 = l_genl_family_new(genl, NL80211_GENL_NAME);
anqp_requests = l_queue_new();
@ -492,13 +492,14 @@ bool anqp_init(struct l_genl_family *in)
NULL, NULL))
l_error("Registering for MLME notification failed");
return true;
return 0;
}
void anqp_exit(void)
static void anqp_exit(void)
{
struct l_genl *genl = iwd_get_genl();
l_genl_family_free(nl80211);
nl80211 = NULL;
l_queue_destroy(anqp_requests, anqp_destroy);
@ -507,3 +508,6 @@ void anqp_exit(void)
l_genl_remove_unicast_watch(genl, unicast_watch);
}
IWD_MODULE(anqp, anqp_init, anqp_exit);
IWD_MODULE_DEPENDS(anqp, netdev);

View File

@ -38,6 +38,3 @@ uint32_t anqp_request(uint32_t ifindex, const uint8_t *addr,
struct scan_bss *bss, const uint8_t *anqp, size_t len,
anqp_response_func_t cb, void *user_data,
anqp_destroy_func_t destroy);
bool anqp_init(struct l_genl_family *in);
void anqp_exit(void);

View File

@ -155,7 +155,6 @@ static void nl80211_appeared(const struct l_genl_family_info *info,
plugin_init(plugins, noplugins);
manager_init(nl80211, interfaces, nointerfaces);
anqp_init(nl80211);
if (!wiphy_init(nl80211, phys, nophys))
l_error("Unable to init wiphy functionality");
@ -492,7 +491,6 @@ int main(int argc, char *argv[])
if (nl80211) {
manager_exit();
anqp_exit();
wiphy_exit();
l_genl_family_free(nl80211);
}