]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Optimize default case for own freq preference setting
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 19 Nov 2013 10:29:25 +0000 (12:29 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 19 Nov 2013 10:29:25 +0000 (12:29 +0200)
There is no need to use wpas_p2p_num_unused_channels() here in the
default configuration of p2p_ignore_sahred_freq=0, so re-order the
conditions to skip that operation. This is a bit more efficient and the
debug log is also a bit cleaner in the default case.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/p2p_supplicant.c

index 20eee0ab4c06d6ef8070a0cfd685231ec4eccf4e..407f3e4d4eccfc4296e201d9c64b28cc32d44c40 100644 (file)
@@ -177,9 +177,9 @@ static void wpas_p2p_set_own_freq_preference(struct wpa_supplicant *wpa_s,
 {
        if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
                return;
-       if (freq > 0 && wpa_s->num_multichan_concurrent > 1 &&
-           wpas_p2p_num_unused_channels(wpa_s) > 0 &&
-           wpa_s->parent->conf->p2p_ignore_shared_freq) {
+       if (wpa_s->parent->conf->p2p_ignore_shared_freq &&
+           freq > 0 && wpa_s->num_multichan_concurrent > 1 &&
+           wpas_p2p_num_unused_channels(wpa_s) > 0) {
                wpa_printf(MSG_DEBUG, "P2P: Ignore own channel preference %d MHz due to p2p_ignore_shared_freq=1 configuration",
                           freq);
                freq = 0;