static void p2p_prepare_channel_best(struct p2p_data *p2p)
{
u8 op_class, op_channel;
- const int op_classes_5ghz[] = { 115, 124, 0 };
- const int op_classes_ht40[] = { 116, 117, 126, 127, 0 };
+ const int op_classes_5ghz[] = { 124, 115, 0 };
+ const int op_classes_ht40[] = { 126, 127, 116, 117, 0 };
const int op_classes_vht[] = { 128, 0 };
p2p_dbg(p2p, "Prepare channel best");
int freq;
u8 op_reg_class, op_channel;
unsigned int i;
- const int op_classes_5ghz[] = { 115, 124, 0 };
- const int op_classes_ht40[] = { 116, 117, 126, 127, 0 };
+ const int op_classes_5ghz[] = { 124, 115, 0 };
+ const int op_classes_ht40[] = { 126, 127, 116, 117, 0 };
const int op_classes_vht[] = { 128, 0 };
if (p2p->own_freq_preference > 0 &&
{
unsigned int i, j, r;
- for (i = 0; i < chans->reg_classes; i++) {
- struct p2p_reg_class *c = &chans->reg_class[i];
+ for (j = 0; classes[j]; j++) {
+ for (i = 0; i < chans->reg_classes; i++) {
+ struct p2p_reg_class *c = &chans->reg_class[i];
- if (c->channels == 0)
- continue;
+ if (c->channels == 0)
+ continue;
- for (j = 0; classes[j]; j++) {
- if (c->reg_class == classes[j])
- break;
+ if (c->reg_class == classes[j]) {
+ /*
+ * Pick one of the available channels in the
+ * operating class at random.
+ */
+ os_get_random((u8 *) &r, sizeof(r));
+ r %= c->channels;
+ *op_class = c->reg_class;
+ *op_channel = c->channel[r];
+ return 0;
+ }
}
- if (!classes[j])
- continue;
-
- /*
- * Pick one of the available channels in the operating class at
- * random.
- */
- os_get_random((u8 *) &r, sizeof(r));
- r %= c->channels;
- *op_class = c->reg_class;
- *op_channel = c->channel[r];
- return 0;
}
return -1;