Skip to content

Commit

Permalink
cfg80211: remove enum ieee80211_band
Browse files Browse the repository at this point in the history
This enum is already perfectly aliased to enum nl80211_band, and
the only reason for it is that we get IEEE80211_NUM_BANDS out of
it. There's no really good reason to not declare the number of
bands in nl80211 though, so do that and remove the cfg80211 one.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
jmberg-intel committed Apr 12, 2016
1 parent 35eb8f7 commit 57fbcce
Show file tree
Hide file tree
Showing 230 changed files with 1,420 additions and 1,437 deletions.
1 change: 0 additions & 1 deletion Documentation/DocBook/80211.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
<chapter>
<title>Device registration</title>
!Pinclude/net/cfg80211.h Device registration
!Finclude/net/cfg80211.h ieee80211_band
!Finclude/net/cfg80211.h ieee80211_channel_flags
!Finclude/net/cfg80211.h ieee80211_channel
!Finclude/net/cfg80211.h ieee80211_rate_flags
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/admtek/adm8211.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev)
rx_status.rate_idx = rate;

rx_status.freq = adm8211_channels[priv->channel - 1].center_freq;
rx_status.band = IEEE80211_BAND_2GHZ;
rx_status.band = NL80211_BAND_2GHZ;

memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
ieee80211_rx_irqsafe(dev, skb);
Expand Down Expand Up @@ -1894,7 +1894,7 @@ static int adm8211_probe(struct pci_dev *pdev,

priv->channel = 1;

dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
dev->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;

err = ieee80211_register_hw(dev);
if (err) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath/ar5523/ar5523.c
Original file line number Diff line number Diff line change
Expand Up @@ -1471,12 +1471,12 @@ static int ar5523_init_modes(struct ar5523 *ar)
memcpy(ar->channels, ar5523_channels, sizeof(ar5523_channels));
memcpy(ar->rates, ar5523_rates, sizeof(ar5523_rates));

ar->band.band = IEEE80211_BAND_2GHZ;
ar->band.band = NL80211_BAND_2GHZ;
ar->band.channels = ar->channels;
ar->band.n_channels = ARRAY_SIZE(ar5523_channels);
ar->band.bitrates = ar->rates;
ar->band.n_bitrates = ARRAY_SIZE(ar5523_rates);
ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar->band;
ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = &ar->band;
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct ath_common {
bool bt_ant_diversity;

int last_rssi;
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
};

static inline const struct ath_ps_ops *ath_ps_ops(struct ath_common *common)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath10k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ struct ath10k {
} scan;

struct {
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
struct ieee80211_supported_band sbands[NUM_NL80211_BANDS];
} mac;

/* should never be NULL; needed for regular htt rx */
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/wireless/ath/ath10k/htt_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2182,9 +2182,9 @@ static void ath10k_htt_rx_tx_mode_switch_ind(struct ath10k *ar,
ath10k_mac_tx_push_pending(ar);
}

static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
static inline enum nl80211_band phy_mode_to_band(u32 phy_mode)
{
enum ieee80211_band band;
enum nl80211_band band;

switch (phy_mode) {
case MODE_11A:
Expand All @@ -2193,7 +2193,7 @@ static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
case MODE_11AC_VHT20:
case MODE_11AC_VHT40:
case MODE_11AC_VHT80:
band = IEEE80211_BAND_5GHZ;
band = NL80211_BAND_5GHZ;
break;
case MODE_11G:
case MODE_11B:
Expand All @@ -2204,7 +2204,7 @@ static inline enum ieee80211_band phy_mode_to_band(u32 phy_mode)
case MODE_11AC_VHT40_2G:
case MODE_11AC_VHT80_2G:
default:
band = IEEE80211_BAND_2GHZ;
band = NL80211_BAND_2GHZ;
}

return band;
Expand Down
68 changes: 34 additions & 34 deletions drivers/net/wireless/ath/ath10k/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef)
enum wmi_phy_mode phymode = MODE_UNKNOWN;

switch (chandef->chan->band) {
case IEEE80211_BAND_2GHZ:
case NL80211_BAND_2GHZ:
switch (chandef->width) {
case NL80211_CHAN_WIDTH_20_NOHT:
if (chandef->chan->flags & IEEE80211_CHAN_NO_OFDM)
Expand All @@ -505,7 +505,7 @@ chan_to_phymode(const struct cfg80211_chan_def *chandef)
break;
}
break;
case IEEE80211_BAND_5GHZ:
case NL80211_BAND_5GHZ:
switch (chandef->width) {
case NL80211_CHAN_WIDTH_20_NOHT:
phymode = MODE_11A;
Expand Down Expand Up @@ -2055,7 +2055,7 @@ static void ath10k_peer_assoc_h_rates(struct ath10k *ar,
struct cfg80211_chan_def def;
const struct ieee80211_supported_band *sband;
const struct ieee80211_rate *rates;
enum ieee80211_band band;
enum nl80211_band band;
u32 ratemask;
u8 rate;
int i;
Expand Down Expand Up @@ -2115,7 +2115,7 @@ static void ath10k_peer_assoc_h_ht(struct ath10k *ar,
const struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
struct cfg80211_chan_def def;
enum ieee80211_band band;
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
int i, n;
Expand Down Expand Up @@ -2339,7 +2339,7 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,
const struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
struct cfg80211_chan_def def;
enum ieee80211_band band;
enum nl80211_band band;
const u16 *vht_mcs_mask;
u8 ampdu_factor;

Expand All @@ -2357,7 +2357,7 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar,

arg->peer_flags |= ar->wmi.peer_flags->vht;

if (def.chan->band == IEEE80211_BAND_2GHZ)
if (def.chan->band == NL80211_BAND_2GHZ)
arg->peer_flags |= ar->wmi.peer_flags->vht_2g;

arg->peer_vht_caps = vht_cap->cap;
Expand Down Expand Up @@ -2426,7 +2426,7 @@ static void ath10k_peer_assoc_h_qos(struct ath10k *ar,

static bool ath10k_mac_sta_has_ofdm_only(struct ieee80211_sta *sta)
{
return sta->supp_rates[IEEE80211_BAND_2GHZ] >>
return sta->supp_rates[NL80211_BAND_2GHZ] >>
ATH10K_MAC_FIRST_OFDM_RATE_IDX;
}

Expand All @@ -2437,7 +2437,7 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
{
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
struct cfg80211_chan_def def;
enum ieee80211_band band;
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
enum wmi_phy_mode phymode = MODE_UNKNOWN;
Expand All @@ -2450,7 +2450,7 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;

switch (band) {
case IEEE80211_BAND_2GHZ:
case NL80211_BAND_2GHZ:
if (sta->vht_cap.vht_supported &&
!ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) {
if (sta->bandwidth == IEEE80211_STA_RX_BW_40)
Expand All @@ -2470,7 +2470,7 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
}

break;
case IEEE80211_BAND_5GHZ:
case NL80211_BAND_5GHZ:
/*
* Check VHT first.
*/
Expand Down Expand Up @@ -2848,7 +2848,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
{
struct ieee80211_hw *hw = ar->hw;
struct ieee80211_supported_band **bands;
enum ieee80211_band band;
enum nl80211_band band;
struct ieee80211_channel *channel;
struct wmi_scan_chan_list_arg arg = {0};
struct wmi_channel_arg *ch;
Expand All @@ -2860,7 +2860,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
lockdep_assert_held(&ar->conf_mutex);

bands = hw->wiphy->bands;
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
for (band = 0; band < NUM_NL80211_BANDS; band++) {
if (!bands[band])
continue;

Expand All @@ -2879,7 +2879,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
return -ENOMEM;

ch = arg.channels;
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
for (band = 0; band < NUM_NL80211_BANDS; band++) {
if (!bands[band])
continue;

Expand Down Expand Up @@ -2917,7 +2917,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
/* FIXME: why use only legacy modes, why not any
* HT/VHT modes? Would that even make any
* difference? */
if (channel->band == IEEE80211_BAND_2GHZ)
if (channel->band == NL80211_BAND_2GHZ)
ch->mode = MODE_11G;
else
ch->mode = MODE_11A;
Expand Down Expand Up @@ -4254,14 +4254,14 @@ static void ath10k_mac_setup_ht_vht_cap(struct ath10k *ar)
vht_cap = ath10k_create_vht_cap(ar);

if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
band = &ar->mac.sbands[IEEE80211_BAND_2GHZ];
band = &ar->mac.sbands[NL80211_BAND_2GHZ];
band->ht_cap = ht_cap;

/* Enable the VHT support at 2.4 GHz */
band->vht_cap = vht_cap;
}
if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
band = &ar->mac.sbands[IEEE80211_BAND_5GHZ];
band = &ar->mac.sbands[NL80211_BAND_5GHZ];
band->ht_cap = ht_cap;
band->vht_cap = vht_cap;
}
Expand Down Expand Up @@ -5595,7 +5595,7 @@ static void ath10k_sta_rc_update_wk(struct work_struct *wk)
struct ath10k_sta *arsta;
struct ieee80211_sta *sta;
struct cfg80211_chan_def def;
enum ieee80211_band band;
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
u32 changed, bw, nss, smps;
Expand Down Expand Up @@ -6394,14 +6394,14 @@ static int ath10k_get_survey(struct ieee80211_hw *hw, int idx,

mutex_lock(&ar->conf_mutex);

sband = hw->wiphy->bands[IEEE80211_BAND_2GHZ];
sband = hw->wiphy->bands[NL80211_BAND_2GHZ];
if (sband && idx >= sband->n_channels) {
idx -= sband->n_channels;
sband = NULL;
}

if (!sband)
sband = hw->wiphy->bands[IEEE80211_BAND_5GHZ];
sband = hw->wiphy->bands[NL80211_BAND_5GHZ];

if (!sband || idx >= sband->n_channels) {
ret = -ENOENT;
Expand All @@ -6424,7 +6424,7 @@ static int ath10k_get_survey(struct ieee80211_hw *hw, int idx,

static bool
ath10k_mac_bitrate_mask_has_single_rate(struct ath10k *ar,
enum ieee80211_band band,
enum nl80211_band band,
const struct cfg80211_bitrate_mask *mask)
{
int num_rates = 0;
Expand All @@ -6443,7 +6443,7 @@ ath10k_mac_bitrate_mask_has_single_rate(struct ath10k *ar,

static bool
ath10k_mac_bitrate_mask_get_single_nss(struct ath10k *ar,
enum ieee80211_band band,
enum nl80211_band band,
const struct cfg80211_bitrate_mask *mask,
int *nss)
{
Expand Down Expand Up @@ -6492,7 +6492,7 @@ ath10k_mac_bitrate_mask_get_single_nss(struct ath10k *ar,

static int
ath10k_mac_bitrate_mask_get_single_rate(struct ath10k *ar,
enum ieee80211_band band,
enum nl80211_band band,
const struct cfg80211_bitrate_mask *mask,
u8 *rate, u8 *nss)
{
Expand Down Expand Up @@ -6593,7 +6593,7 @@ static int ath10k_mac_set_fixed_rate_params(struct ath10k_vif *arvif,

static bool
ath10k_mac_can_set_bitrate_mask(struct ath10k *ar,
enum ieee80211_band band,
enum nl80211_band band,
const struct cfg80211_bitrate_mask *mask)
{
int i;
Expand Down Expand Up @@ -6645,7 +6645,7 @@ static int ath10k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
struct cfg80211_chan_def def;
struct ath10k *ar = arvif->ar;
enum ieee80211_band band;
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
u8 rate;
Expand Down Expand Up @@ -7275,7 +7275,7 @@ static const struct ieee80211_ops ath10k_ops = {
};

#define CHAN2G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_2GHZ, \
.band = NL80211_BAND_2GHZ, \
.hw_value = (_channel), \
.center_freq = (_freq), \
.flags = (_flags), \
Expand All @@ -7284,7 +7284,7 @@ static const struct ieee80211_ops ath10k_ops = {
}

#define CHAN5G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_5GHZ, \
.band = NL80211_BAND_5GHZ, \
.hw_value = (_channel), \
.center_freq = (_freq), \
.flags = (_flags), \
Expand Down Expand Up @@ -7604,13 +7604,13 @@ int ath10k_mac_register(struct ath10k *ar)
goto err_free;
}

band = &ar->mac.sbands[IEEE80211_BAND_2GHZ];
band = &ar->mac.sbands[NL80211_BAND_2GHZ];
band->n_channels = ARRAY_SIZE(ath10k_2ghz_channels);
band->channels = channels;
band->n_bitrates = ath10k_g_rates_size;
band->bitrates = ath10k_g_rates;

ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = band;
ar->hw->wiphy->bands[NL80211_BAND_2GHZ] = band;
}

if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
Expand All @@ -7622,12 +7622,12 @@ int ath10k_mac_register(struct ath10k *ar)
goto err_free;
}

band = &ar->mac.sbands[IEEE80211_BAND_5GHZ];
band = &ar->mac.sbands[NL80211_BAND_5GHZ];
band->n_channels = ARRAY_SIZE(ath10k_5ghz_channels);
band->channels = channels;
band->n_bitrates = ath10k_a_rates_size;
band->bitrates = ath10k_a_rates;
ar->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = band;
ar->hw->wiphy->bands[NL80211_BAND_5GHZ] = band;
}

ath10k_mac_setup_ht_vht_cap(ar);
Expand Down Expand Up @@ -7815,8 +7815,8 @@ int ath10k_mac_register(struct ath10k *ar)
ar->dfs_detector->exit(ar->dfs_detector);

err_free:
kfree(ar->mac.sbands[IEEE80211_BAND_2GHZ].channels);
kfree(ar->mac.sbands[IEEE80211_BAND_5GHZ].channels);
kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);

SET_IEEE80211_DEV(ar->hw, NULL);
return ret;
Expand All @@ -7829,8 +7829,8 @@ void ath10k_mac_unregister(struct ath10k *ar)
if (config_enabled(CONFIG_ATH10K_DFS_CERTIFIED) && ar->dfs_detector)
ar->dfs_detector->exit(ar->dfs_detector);

kfree(ar->mac.sbands[IEEE80211_BAND_2GHZ].channels);
kfree(ar->mac.sbands[IEEE80211_BAND_5GHZ].channels);
kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);
kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);

SET_IEEE80211_DEV(ar->hw, NULL);
}
Loading

0 comments on commit 57fbcce

Please sign in to comment.