hostap: nl80211 use nl80211_put_freq_params

Use nl80211_put_freq_params when it possible. Remove
duplicated code.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
This commit is contained in:
Janusz Dziedzic 2014-09-26 20:21:24 +02:00 committed by Jouni Malinen
parent 816e3df972
commit ed8e005973

View file

@ -11522,53 +11522,9 @@ static int nl80211_start_radar_detection(void *priv,
nl80211_cmd(bss->drv, msg, 0, NL80211_CMD_RADAR_DETECT);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq->freq);
if (freq->vht_enabled) {
switch (freq->bandwidth) {
case 20:
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
NL80211_CHAN_WIDTH_20);
break;
case 40:
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
NL80211_CHAN_WIDTH_40);
break;
case 80:
if (freq->center_freq2)
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
NL80211_CHAN_WIDTH_80P80);
else
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
NL80211_CHAN_WIDTH_80);
break;
case 160:
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
NL80211_CHAN_WIDTH_160);
break;
default:
return -1;
}
NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1, freq->center_freq1);
if (freq->center_freq2)
NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ2,
freq->center_freq2);
} else if (freq->ht_enabled) {
switch (freq->sec_channel_offset) {
case -1:
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
NL80211_CHAN_HT40MINUS);
break;
case 1:
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
NL80211_CHAN_HT40PLUS);
break;
default:
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
NL80211_CHAN_HT20);
break;
}
}
if (nl80211_put_freq_params(msg, freq) < 0)
goto nla_put_failure;
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
if (ret == 0)