mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
scan: make scan_freq_set const in scan_passive
The scan_passive API wasn't using a const struct scan_freq_set as it should be since it's not modifying the contents. Changing this to const did require some additional changes like making the scan_parameters 'freqs' member const as well. After changing scan_parameters, p2p needed updating since it was using scan_parameters.freqs directly. This was changed to using a separate scan_freq_set pointer, then setting to scan_parameters.freqs when needed.
This commit is contained in:
parent
7d6a38de93
commit
b52ed27b72
21
src/p2p.c
21
src/p2p.c
@ -1977,6 +1977,7 @@ static bool p2p_provision_scan_notify(int err, struct l_queue *bss_list,
|
||||
static void p2p_provision_scan_start(struct p2p_device *dev)
|
||||
{
|
||||
struct scan_parameters params = {};
|
||||
struct scan_freq_set *freqs = NULL;
|
||||
uint8_t buf[256];
|
||||
|
||||
params.flush = true;
|
||||
@ -2005,16 +2006,17 @@ static void p2p_provision_scan_start(struct p2p_device *dev)
|
||||
* contain all of the 2.4 and 5G channels.
|
||||
*/
|
||||
if (dev->conn_go_scan_retry < 12) {
|
||||
params.freqs = scan_freq_set_new();
|
||||
scan_freq_set_add(params.freqs, dev->conn_go_oper_freq);
|
||||
freqs = scan_freq_set_new();
|
||||
scan_freq_set_add(freqs, dev->conn_go_oper_freq);
|
||||
params.freqs = freqs;
|
||||
}
|
||||
|
||||
dev->scan_id = scan_active_full(dev->wdev_id, ¶ms, NULL,
|
||||
p2p_provision_scan_notify, dev,
|
||||
p2p_scan_destroy);
|
||||
|
||||
if (params.freqs)
|
||||
scan_freq_set_free(params.freqs);
|
||||
if (freqs)
|
||||
scan_freq_set_free(freqs);
|
||||
}
|
||||
|
||||
static void p2p_start_client_provision(struct p2p_device *dev)
|
||||
@ -3777,6 +3779,7 @@ schedule:
|
||||
static bool p2p_device_scan_start(struct p2p_device *dev)
|
||||
{
|
||||
struct scan_parameters params = {};
|
||||
struct scan_freq_set *freqs;
|
||||
uint8_t buf[256];
|
||||
unsigned int i;
|
||||
|
||||
@ -3812,13 +3815,13 @@ static bool p2p_device_scan_start(struct p2p_device *dev)
|
||||
* Request frames intended for both P2P Devices and non-P2P Devices."
|
||||
*/
|
||||
params.no_cck_rates = true;
|
||||
params.freqs = scan_freq_set_new();
|
||||
freqs = scan_freq_set_new();
|
||||
|
||||
for (i = 0; i < L_ARRAY_SIZE(channels_social); i++) {
|
||||
int chan = channels_social[i];
|
||||
uint32_t freq = band_channel_to_freq(chan, BAND_FREQ_2_4_GHZ);
|
||||
|
||||
scan_freq_set_add(params.freqs, freq);
|
||||
scan_freq_set_add(freqs, freq);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3845,12 +3848,14 @@ static bool p2p_device_scan_start(struct p2p_device *dev)
|
||||
dev->chans_per_scan = CHANS_PER_SCAN;
|
||||
}
|
||||
|
||||
scan_freq_set_add(params.freqs, freq);
|
||||
scan_freq_set_add(freqs, freq);
|
||||
}
|
||||
|
||||
params.freqs = freqs;
|
||||
|
||||
dev->scan_id = scan_active_full(dev->wdev_id, ¶ms, NULL,
|
||||
p2p_scan_notify, dev, p2p_scan_destroy);
|
||||
scan_freq_set_free(params.freqs);
|
||||
scan_freq_set_free(freqs);
|
||||
|
||||
return dev->scan_id != 0;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ static void scan_freq_append(uint32_t freq, void *user_data)
|
||||
}
|
||||
|
||||
static void scan_build_attr_scan_frequencies(struct l_genl_msg *msg,
|
||||
struct scan_freq_set *freqs)
|
||||
const struct scan_freq_set *freqs)
|
||||
{
|
||||
struct scan_freq_append_data append_data = { msg, 0 };
|
||||
|
||||
@ -654,7 +654,7 @@ static uint32_t scan_common(uint64_t wdev_id, bool passive,
|
||||
priority, &work_ops);
|
||||
}
|
||||
|
||||
uint32_t scan_passive(uint64_t wdev_id, struct scan_freq_set *freqs,
|
||||
uint32_t scan_passive(uint64_t wdev_id, const struct scan_freq_set *freqs,
|
||||
scan_trigger_func_t trigger, scan_notify_func_t notify,
|
||||
void *userdata, scan_destroy_func_t destroy)
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ struct scan_bss {
|
||||
struct scan_parameters {
|
||||
const uint8_t *extra_ie;
|
||||
size_t extra_ie_size;
|
||||
struct scan_freq_set *freqs;
|
||||
const struct scan_freq_set *freqs;
|
||||
uint16_t duration;
|
||||
bool flush : 1;
|
||||
bool randomize_mac_addr_hint : 1;
|
||||
@ -129,7 +129,7 @@ struct l_genl_msg *scan_build_trigger_scan_bss(uint32_t ifindex,
|
||||
const uint8_t *ssid,
|
||||
uint32_t ssid_len);
|
||||
|
||||
uint32_t scan_passive(uint64_t wdev_id, struct scan_freq_set *freqs,
|
||||
uint32_t scan_passive(uint64_t wdev_id, const struct scan_freq_set *freqs,
|
||||
scan_trigger_func_t trigger, scan_notify_func_t notify,
|
||||
void *userdata, scan_destroy_func_t destroy);
|
||||
uint32_t scan_passive_full(uint64_t wdev_id,
|
||||
|
Loading…
Reference in New Issue
Block a user