P2P: Clean up wpas_p2p_init_go_params()
It is clearer if there is only a single loop of the channel list and shared debug prints. In addition, the note about current operating channels not being available is quite confusing if there are no operating group, so make that part of the message conditional. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
384bdd021b
commit
7d669cf7a1
1 changed files with 24 additions and 33 deletions
|
@ -4608,41 +4608,32 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
|
||||||
}
|
}
|
||||||
num = res;
|
num = res;
|
||||||
|
|
||||||
if (!freq) {
|
for (i = 0; i < num; i++) {
|
||||||
for (i = 0; i < num; i++) {
|
if (freq && freqs[i] == freq)
|
||||||
if (freq_included(channels, freqs[i])) {
|
break;
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Force GO on a channel we are already using (%u MHz)",
|
if (!freq && freq_included(channels, freqs[i])) {
|
||||||
freqs[i]);
|
wpa_printf(MSG_DEBUG, "P2P: Force GO on a channel we are already using (%u MHz)",
|
||||||
params->freq = freqs[i];
|
freqs[i]);
|
||||||
break;
|
params->freq = freqs[i];
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if (i == num) {
|
|
||||||
if (wpas_p2p_num_unused_channels(wpa_s) <= 0) {
|
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Cannot force GO on any of the channels we are already using");
|
|
||||||
os_free(freqs);
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Cannot force GO on any of the channels we are already using. Use one of the free channels");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < num; i++) {
|
|
||||||
if (freqs[i] == freq)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == num) {
|
|
||||||
if (wpas_p2p_num_unused_channels(wpa_s) <= 0) {
|
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Cannot force GO on freq (%u MHz) as all the channels are in use", freq);
|
|
||||||
os_free(freqs);
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Cannot force GO on any of the channels we are already using. Use one of the free channels");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i == num) {
|
||||||
|
if (wpas_p2p_num_unused_channels(wpa_s) <= 0) {
|
||||||
|
if (freq)
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Cannot force GO on freq (%u MHz) as all the channels are in use", freq);
|
||||||
|
else
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Cannot force GO on any of the channels we are already using");
|
||||||
|
os_free(freqs);
|
||||||
|
return -1;
|
||||||
|
} else if (num == 0) {
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Use one of the free channels");
|
||||||
|
} else {
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Cannot force GO on any of the channels we are already using. Use one of the free channels");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
os_free(freqs);
|
os_free(freqs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue