Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 04/11] anqp: utilize IWD_MODULE
Date: Fri, 11 Oct 2019 10:24:10 -0700	[thread overview]
Message-ID: <20191011172417.23328-4-prestwoj@gmail.com> (raw)
In-Reply-To: <20191011172417.23328-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]

This converts anqp into an IWD module.
---
 src/anqp.c | 12 ++++++++----
 src/anqp.h |  3 ---
 src/main.c |  2 --
 3 files changed, 8 insertions(+), 9 deletions(-)

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 2e8d4a6d..4619a84c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -153,7 +153,6 @@ static void nl80211_appeared(const struct l_genl_family_info *info,
 	}
 
 	manager_init(nl80211, interfaces, nointerfaces);
-	anqp_init(nl80211);
 
 	if (!wiphy_init(nl80211, phys, nophys))
 		l_error("Unable to init wiphy functionality");
@@ -491,7 +490,6 @@ int main(int argc, char *argv[])
 
 	if (nl80211) {
 		manager_exit();
-		anqp_exit();
 		wiphy_exit();
 		l_genl_family_free(nl80211);
 	}
-- 
2.17.1

  parent reply	other threads:[~2019-10-11 17:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 17:24 [PATCH 01/11] main: move module init into nl80211_appeared James Prestwood
2019-10-11 17:24 ` [PATCH 02/11] netdev: utilize IWD_MODULE James Prestwood
2019-10-11 17:24 ` [PATCH 03/11] eapol: " James Prestwood
2019-10-11 17:24 ` James Prestwood [this message]
2019-10-11 17:24 ` [PATCH 05/11] agent: " James Prestwood
2019-10-11 18:53   ` Denis Kenzior
2019-10-11 17:24 ` [PATCH 06/11] manager: " James Prestwood
2019-10-11 18:57   ` Denis Kenzior
2019-10-11 17:24 ` [PATCH 07/11] wiphy: " James Prestwood
2019-10-11 17:24 ` [PATCH 08/11] eap: remove mtu argument from eap_init James Prestwood
2019-10-11 17:24 ` [PATCH 09/11] wired: update with new eap_init James Prestwood
2019-10-11 17:24 ` [PATCH 10/11] unit: update wsc/eapol " James Prestwood
2019-10-11 17:24 ` [PATCH 11/11] eap: utilize IWD_MODULE James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191011172417.23328-4-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox