diff mbox series

[v2,1/4] knownnetworks: pass scan_bss to known_network_add_frequency

Message ID 20240124134001.20453-1-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [v2,1/4] knownnetworks: pass scan_bss to known_network_add_frequency | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-alpine-ci-incremental_build success Incremental Build with patches
prestwoj/iwd-ci-incremental_build success Incremental Build with patches
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

James Prestwood Jan. 24, 2024, 1:39 p.m. UTC
This prepares to store known frequencies sorted by BSS rank.
---
 src/knownnetworks.c | 6 +++---
 src/knownnetworks.h | 3 ++-
 src/network.c       | 6 +++---
 3 files changed, 8 insertions(+), 7 deletions(-)

Comments

Denis Kenzior Jan. 24, 2024, 6:16 p.m. UTC | #1
Hi James,

On 1/24/24 07:39, James Prestwood wrote:
> This prepares to store known frequencies sorted by BSS rank.
> ---
>   src/knownnetworks.c | 6 +++---
>   src/knownnetworks.h | 3 ++-
>   src/network.c       | 6 +++---
>   3 files changed, 8 insertions(+), 7 deletions(-)
> 

I'm actually fine with this patch, but small nit:

> diff --git a/src/knownnetworks.c b/src/knownnetworks.c
> index 04ce74ec..f6284fdc 100644
> --- a/src/knownnetworks.c
> +++ b/src/knownnetworks.c
> @@ -566,7 +566,7 @@ static bool known_frequency_match(const void *a, const void *b)
>    * Adds a frequency to the 'known' set of frequencies that this network
>    * operates on.  The list is sorted according to most-recently seen
>    */
> -int known_network_add_frequency(struct network_info *info, uint32_t frequency)
> +int known_network_add_frequency(struct network_info *info, struct scan_bss *bss)

const struct scan_bss ?

>   {
>   	struct known_frequency *known_freq;
>   

Regards,
-Denis
diff mbox series

Patch

diff --git a/src/knownnetworks.c b/src/knownnetworks.c
index 04ce74ec..f6284fdc 100644
--- a/src/knownnetworks.c
+++ b/src/knownnetworks.c
@@ -566,7 +566,7 @@  static bool known_frequency_match(const void *a, const void *b)
  * Adds a frequency to the 'known' set of frequencies that this network
  * operates on.  The list is sorted according to most-recently seen
  */
-int known_network_add_frequency(struct network_info *info, uint32_t frequency)
+int known_network_add_frequency(struct network_info *info, struct scan_bss *bss)
 {
 	struct known_frequency *known_freq;
 
@@ -574,10 +574,10 @@  int known_network_add_frequency(struct network_info *info, uint32_t frequency)
 		info->known_frequencies = l_queue_new();
 
 	known_freq = l_queue_remove_if(info->known_frequencies,
-					known_frequency_match, &frequency);
+					known_frequency_match, &bss->frequency);
 	if (!known_freq) {
 		known_freq = l_new(struct known_frequency, 1);
-		known_freq->frequency = frequency;
+		known_freq->frequency = bss->frequency;
 	}
 
 	l_queue_push_head(info->known_frequencies, known_freq);
diff --git a/src/knownnetworks.h b/src/knownnetworks.h
index e8ffac0b..9f81e308 100644
--- a/src/knownnetworks.h
+++ b/src/knownnetworks.h
@@ -114,7 +114,8 @@  struct network_info *known_networks_find(const char *ssid,
 
 struct scan_freq_set *known_networks_get_recent_frequencies(
 						uint8_t num_networks_tosearch);
-int known_network_add_frequency(struct network_info *info, uint32_t frequency);
+int known_network_add_frequency(struct network_info *info,
+				struct scan_bss *bss);
 void known_network_frequency_sync(struct network_info *info);
 
 uint32_t known_networks_watch_add(known_networks_watch_func_t func,
diff --git a/src/network.c b/src/network.c
index 4723334e..81315746 100644
--- a/src/network.c
+++ b/src/network.c
@@ -807,7 +807,7 @@  static void add_known_frequency(void *data, void *user_data)
 	struct scan_bss *bss = data;
 	struct network_info *info = user_data;
 
-	known_network_add_frequency(info, bss->frequency);
+	known_network_add_frequency(info, bss);
 }
 
 void network_set_info(struct network *network, struct network_info *info)
@@ -1094,7 +1094,7 @@  bool network_bss_add(struct network *network, struct scan_bss *bss)
 		return false;
 
 	if (network->info)
-		known_network_add_frequency(network->info, bss->frequency);
+		known_network_add_frequency(network->info, bss);
 
 	/* Done if BSS is not HS20 or we already have network_info set */
 	if (!bss->hs20_capable)
@@ -1131,7 +1131,7 @@  bool network_bss_update(struct network *network, struct scan_bss *bss)
 
 	/* Sync frequency for already known networks */
 	if (network->info) {
-		known_network_add_frequency(network->info, bss->frequency);
+		known_network_add_frequency(network->info, bss);
 		known_network_frequency_sync(network->info);
 	}