+ if (wrqu->freq.e == 1) {
+ int channel = 0;
+ int f = wrqu->freq.m / 100000;
+ while ((channel < NUM_CHANNELS + 1) && (f != channel_frequency[channel]))
+ channel++;
+
+ if (channel == NUM_CHANNELS) // channel not found
+ return -EINVAL;
+
+ wrqu->freq.e = 0;
+ wrqu->freq.m = channel + 1;
+ }
+ if ((wrqu->freq.e == 0) && (wrqu->freq.m < 1000)) {
+ if (wl_ioctl(dev, WLC_SET_CHANNEL, &wrqu->freq.m, sizeof(int)) < 0)
+ return -EINVAL;
+ } else {
+ return -EINVAL;
+ }