P2P: Modify p2p_get_pref_freq
In p2p_get_pref_freq, if the channels argument is NULL, select a preferred channel that is also one of the P2P Device configured channels. Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
parent
0a816e8cbf
commit
751b00ba28
1 changed files with 7 additions and 5 deletions
|
@ -388,17 +388,19 @@ unsigned int p2p_get_pref_freq(struct p2p_data *p2p,
|
||||||
const struct p2p_channels *channels)
|
const struct p2p_channels *channels)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int freq;
|
int freq = 0;
|
||||||
|
const struct p2p_channels *tmpc = channels ?
|
||||||
|
channels : &p2p->cfg->channels;
|
||||||
|
|
||||||
|
if (tmpc == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
for (i = 0; p2p->cfg->pref_chan && i < p2p->cfg->num_pref_chan; i++) {
|
for (i = 0; p2p->cfg->pref_chan && i < p2p->cfg->num_pref_chan; i++) {
|
||||||
freq = p2p_channel_to_freq(p2p->cfg->pref_chan[i].op_class,
|
freq = p2p_channel_to_freq(p2p->cfg->pref_chan[i].op_class,
|
||||||
p2p->cfg->pref_chan[i].chan);
|
p2p->cfg->pref_chan[i].chan);
|
||||||
if (freq <= 0)
|
if (p2p_channels_includes_freq(tmpc, freq))
|
||||||
continue;
|
|
||||||
if (!channels || p2p_channels_includes_freq(channels, freq))
|
|
||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue