Use common hw_get_freq/hw_get_chan helpers in hostapd

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
This commit is contained in:
Janusz Dziedzic 2015-01-08 12:48:30 +01:00 committed by Jouni Malinen
parent 269dfe232b
commit 5f10b7f498

View file

@ -15,6 +15,7 @@
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "common/ieee802_11_common.h" #include "common/ieee802_11_common.h"
#include "common/wpa_ctrl.h" #include "common/wpa_ctrl.h"
#include "common/hw_features_common.h"
#include "hostapd.h" #include "hostapd.h"
#include "ap_config.h" #include "ap_config.h"
#include "ap_drv_ops.h" #include "ap_drv_ops.h"
@ -1143,35 +1144,11 @@ const char * hostapd_hw_mode_txt(int mode)
int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan) int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan)
{ {
int i; return hw_get_freq(hapd->iface->current_mode, chan);
if (!hapd->iface->current_mode)
return 0;
for (i = 0; i < hapd->iface->current_mode->num_channels; i++) {
struct hostapd_channel_data *ch =
&hapd->iface->current_mode->channels[i];
if (ch->chan == chan)
return ch->freq;
}
return 0;
} }
int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq) int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq)
{ {
int i; return hw_get_chan(hapd->iface->current_mode, freq);
if (!hapd->iface->current_mode)
return 0;
for (i = 0; i < hapd->iface->current_mode->num_channels; i++) {
struct hostapd_channel_data *ch =
&hapd->iface->current_mode->channels[i];
if (ch->freq == freq)
return ch->chan;
}
return 0;
} }