3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 23:09:34 +01:00

station: Simplify station_set_scan_results() calls

Several invocations of station_set_scan_results() base the
'add_to_autoconnect' parameter on station_is_autoconnecting().  Simplify
the code by having station_set_scan_results() invoke that itself.
'add_to_autoconnect' now becomes an 'intent' parameter, specifying
whether autoconnect path should be invoked as a result of these scan
results or not when station is in an appropriate state.  Rename
'add_to_autoconnect' parameter to make this clearer.
This commit is contained in:
Denis Kenzior 2021-09-16 13:47:01 -05:00
parent 514e3b2710
commit c0fe7070a3

View File

@ -648,7 +648,7 @@ static bool bss_free_if_ssid_not_utf8(void *data, void *user_data)
void station_set_scan_results(struct station *station, void station_set_scan_results(struct station *station,
struct l_queue *new_bss_list, struct l_queue *new_bss_list,
const struct scan_freq_set *freqs, const struct scan_freq_set *freqs,
bool add_to_autoconnect) bool trigger_autoconnect)
{ {
const struct l_queue_entry *bss_entry; const struct l_queue_entry *bss_entry;
struct network *network; struct network *network;
@ -711,7 +711,8 @@ void station_set_scan_results(struct station *station,
l_hashmap_foreach_remove(station->networks, process_network, station); l_hashmap_foreach_remove(station->networks, process_network, station);
if (!wait_for_anqp && add_to_autoconnect) { if (!wait_for_anqp && trigger_autoconnect
&& station_is_autoconnecting(station)) {
station_network_foreach(station, network_add_foreach, station); station_network_foreach(station, network_add_foreach, station);
station_autoconnect_next(station); station_autoconnect_next(station);
} }
@ -967,15 +968,13 @@ static bool new_scan_results(int err, struct l_queue *bss_list,
void *userdata) void *userdata)
{ {
struct station *station = userdata; struct station *station = userdata;
bool autoconnect;
station_property_set_scanning(station, false); station_property_set_scanning(station, false);
if (err) if (err)
return false; return false;
autoconnect = station_is_autoconnecting(station); station_set_scan_results(station, bss_list, freqs, true);
station_set_scan_results(station, bss_list, freqs, autoconnect);
return true; return true;
} }
@ -1039,15 +1038,13 @@ static bool station_quick_scan_results(int err, struct l_queue *bss_list,
void *userdata) void *userdata)
{ {
struct station *station = userdata; struct station *station = userdata;
bool autoconnect;
station_property_set_scanning(station, false); station_property_set_scanning(station, false);
if (err) if (err)
goto done; goto done;
autoconnect = station_is_autoconnecting(station); station_set_scan_results(station, bss_list, freqs, true);
station_set_scan_results(station, bss_list, freqs, autoconnect);
done: done:
if (station->state == STATION_STATE_AUTOCONNECT_QUICK) if (station->state == STATION_STATE_AUTOCONNECT_QUICK)
@ -3182,7 +3179,6 @@ static bool station_dbus_scan_results(int err, struct l_queue *bss_list,
{ {
struct station *station = userdata; struct station *station = userdata;
unsigned int next_idx = station->dbus_scan_subset_idx + 1; unsigned int next_idx = station->dbus_scan_subset_idx + 1;
bool autoconnect;
bool last_subset; bool last_subset;
if (err) { if (err) {
@ -3190,8 +3186,7 @@ static bool station_dbus_scan_results(int err, struct l_queue *bss_list,
return false; return false;
} }
autoconnect = station_is_autoconnecting(station); station_set_scan_results(station, bss_list, freqs, true);
station_set_scan_results(station, bss_list, freqs, autoconnect);
last_subset = next_idx >= L_ARRAY_SIZE(station->scan_freqs_order) || last_subset = next_idx >= L_ARRAY_SIZE(station->scan_freqs_order) ||
station->scan_freqs_order[next_idx] == NULL; station->scan_freqs_order[next_idx] == NULL;