diff mbox series

[v2,05/13] wiphy: use nl80211_parse_supported_frequencies

Message ID 20220803213644.277534-5-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [v2,01/13] wiphy: fix runtime error from bit shift | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Aug. 3, 2022, 9:36 p.m. UTC
Removes the parser in wiphy and uses the helper instead
---
 src/wiphy.c | 44 +++-----------------------------------------
 1 file changed, 3 insertions(+), 41 deletions(-)
diff mbox series

Patch

diff --git a/src/wiphy.c b/src/wiphy.c
index 4a778699..3a6cd48c 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -1190,42 +1190,6 @@  static void parse_supported_ciphers(struct wiphy *wiphy, const void *data,
 	}
 }
 
-static void parse_supported_frequencies(struct wiphy *wiphy,
-						struct l_genl_attr *freqs)
-{
-	uint16_t type, len;
-	const void *data;
-	struct l_genl_attr attr;
-
-	while (l_genl_attr_next(freqs, NULL, NULL, NULL)) {
-		uint32_t freq = 0;
-		bool disabled = false;
-
-		if (!l_genl_attr_recurse(freqs, &attr))
-			continue;
-
-		while (l_genl_attr_next(&attr, &type, &len, &data)) {
-
-			switch (type) {
-			case NL80211_FREQUENCY_ATTR_FREQ:
-				freq = *((uint32_t *) data);
-				break;
-			case NL80211_FREQUENCY_ATTR_DISABLED:
-				disabled = true;
-				break;
-			}
-		}
-
-		if (!freq)
-			continue;
-
-		scan_freq_set_add(wiphy->supported_freqs, freq);
-
-		if (disabled)
-			scan_freq_set_add(wiphy->disabled_freqs, freq);
-	}
-}
-
 static int parse_supported_rates(struct l_genl_attr *attr, struct band *band)
 {
 	uint16_t type;
@@ -1445,16 +1409,14 @@  static void parse_supported_bands(struct wiphy *wiphy,
 			band = *bandp;
 
 
-
 		while (l_genl_attr_next(&attr, &type, &len, &data)) {
 			struct l_genl_attr nested;
 
 			switch (type) {
 			case NL80211_BAND_ATTR_FREQS:
-				if (!l_genl_attr_recurse(&attr, &nested))
-					continue;
-
-				parse_supported_frequencies(wiphy, &nested);
+				nl80211_parse_supported_frequencies(&attr,
+							wiphy->supported_freqs,
+							wiphy->disabled_freqs);
 				break;
 
 			case NL80211_BAND_ATTR_RATES: