diff --git a/src/anqp.c b/src/anqp.c index 9f006bd6..a47530ab 100644 --- a/src/anqp.c +++ b/src/anqp.c @@ -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); diff --git a/src/anqp.h b/src/anqp.h index 62d097d1..998277dd 100644 --- a/src/anqp.h +++ b/src/anqp.h @@ -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); diff --git a/src/main.c b/src/main.c index 1acee95e..08bf38a3 100644 --- a/src/main.c +++ b/src/main.c @@ -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); }