From 92faf1228e942ecaad40b32d6fff49cd4d566230 Mon Sep 17 00:00:00 2001 From: Michael Benedict Date: Mon, 22 Apr 2019 15:59:37 +1000 Subject: [PATCH] wireless: fix all kind of warnings Signed-off-by: Michael Benedict --- drivers/net/wireless/bcmdhd4361/dhd_common.c | 2 +- drivers/net/wireless/bcmdhd4361/dhd_linux.c | 7 +- drivers/net/wireless/bcmdhd4361/dhd_rtt.c | 6 +- drivers/net/wireless/bcmdhd4361/wl_android.c | 6 +- drivers/net/wireless/bcmdhd4361/wl_bam.c | 4 +- drivers/net/wireless/bcmdhd4361/wl_cfg80211.c | 93 +++++++++---------- drivers/net/wireless/bcmdhd4361/wl_cfg80211.h | 4 +- drivers/net/wireless/bcmdhd4361/wl_cfgnan.c | 2 +- drivers/net/wireless/bcmdhd4361/wl_cfgp2p.c | 2 +- .../net/wireless/bcmdhd4361/wl_cfgvendor.c | 4 +- include/net/cfg80211.h | 40 ++------ include/net/mac80211.h | 12 +-- include/uapi/linux/nl80211.h | 4 + net/wireless/chan.c | 2 +- net/wireless/core.c | 8 +- net/wireless/debugfs.c | 4 +- net/wireless/ibss.c | 6 +- net/wireless/mesh.c | 4 +- net/wireless/mlme.c | 2 +- net/wireless/nl80211.c | 36 +++---- net/wireless/reg.c | 30 +++--- net/wireless/reg.h | 2 +- net/wireless/scan.c | 14 +-- net/wireless/sme.c | 6 +- net/wireless/trace.h | 8 +- net/wireless/util.c | 40 ++++---- net/wireless/wext-compat.c | 14 +-- 27 files changed, 173 insertions(+), 189 deletions(-) diff --git a/drivers/net/wireless/bcmdhd4361/dhd_common.c b/drivers/net/wireless/bcmdhd4361/dhd_common.c index 707755217696..cfba55c49362 100644 --- a/drivers/net/wireless/bcmdhd4361/dhd_common.c +++ b/drivers/net/wireless/bcmdhd4361/dhd_common.c @@ -3757,7 +3757,7 @@ dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg) WL_PKT_FILTER_FIXED_LEN + WL_PKT_FILTER_PATTERN_FIXED_LEN); } else if ((pkt_filter.type == 2) || (pkt_filter.type == 6)) { int list_cnt = 0; - char *endptr = '\0'; + char *endptr = NULL; wl_pkt_filter_pattern_listel_t *pf_el = (wl_pkt_filter_pattern_listel_t *)&pkt_filterp->u.patlist.patterns[0]; diff --git a/drivers/net/wireless/bcmdhd4361/dhd_linux.c b/drivers/net/wireless/bcmdhd4361/dhd_linux.c index 8004f351b72e..d11d908cf906 100644 --- a/drivers/net/wireless/bcmdhd4361/dhd_linux.c +++ b/drivers/net/wireless/bcmdhd4361/dhd_linux.c @@ -8628,7 +8628,7 @@ dhd_update_iflist_info(dhd_pub_t *dhdp, struct net_device *ndev, int ifidx, /* initialize the dongle provided if name */ if (dngl_name) { strlcpy(ifp->dngl_name, dngl_name, IFNAMSIZ); - } else if (ndev->name) { + } else if (ndev->name[0] != '\0') { strlcpy(ifp->dngl_name, ndev->name, IFNAMSIZ); } if (mac != NULL) @@ -13327,9 +13327,8 @@ void dhd_detach(dhd_pub_t *dhdp) } #endif /* DHD_ERPOM */ - if (&dhd->dhd_hang_process_work) { - cancel_work_sync(&dhd->dhd_hang_process_work); - } + cancel_work_sync(&dhd->dhd_hang_process_work); + /* Prefer adding de-init code above this comment unless necessary. * The idea is to cancel work queue, sysfs and flags at the end. */ diff --git a/drivers/net/wireless/bcmdhd4361/dhd_rtt.c b/drivers/net/wireless/bcmdhd4361/dhd_rtt.c index b3765e773216..1fd2178571cb 100644 --- a/drivers/net/wireless/bcmdhd4361/dhd_rtt.c +++ b/drivers/net/wireless/bcmdhd4361/dhd_rtt.c @@ -2703,16 +2703,16 @@ dhd_rtt_avail_channel(dhd_pub_t *dhd, wifi_channel_info *channel_info) if (CHSPEC_IS2G(c) && (channel >= CH_MIN_2G_CHANNEL) && (channel <= CH_MAX_2G_CHANNEL)) { channel_info->center_freq = - ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); } else if (CHSPEC_IS5G(c) && channel >= CH_MIN_5G_CHANNEL) { channel_info->center_freq = - ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); } if ((channel_info->width == WIFI_CHAN_WIDTH_80) || (channel_info->width == WIFI_CHAN_WIDTH_40)) { channel = CHSPEC_CHANNEL(c); channel_info->center_freq0 = - ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); } } else { DHD_ERROR(("Failed to get the chanspec \n")); diff --git a/drivers/net/wireless/bcmdhd4361/wl_android.c b/drivers/net/wireless/bcmdhd4361/wl_android.c index ae55fb6e82e5..170047244e0c 100644 --- a/drivers/net/wireless/bcmdhd4361/wl_android.c +++ b/drivers/net/wireless/bcmdhd4361/wl_android.c @@ -4018,7 +4018,7 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str, done: if ((retry == 0) || (ret < 0)) { /* On failure, fallback to a default channel */ - if ((band == WLC_BAND_5G)) { + if (band == WLC_BAND_5G) { channel = APCS_DEFAULT_5G_CH; } else { channel = APCS_DEFAULT_2G_CH; @@ -7931,9 +7931,11 @@ wl_genl_send_msg( int pid = 0; u8 *ptr = NULL, *p = NULL; u32 tot_len = sizeof(bcm_event_hdr_t) + subhdr_len + len; - u16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; + gfp_t kflags; struct bcm_cfg80211 *cfg = wl_get_cfg(ndev); + kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; + WL_DBG(("Enter \n")); /* Decide between STRING event and Data event */ diff --git a/drivers/net/wireless/bcmdhd4361/wl_bam.c b/drivers/net/wireless/bcmdhd4361/wl_bam.c index 661f1fe40516..30cdda8123ed 100644 --- a/drivers/net/wireless/bcmdhd4361/wl_bam.c +++ b/drivers/net/wireless/bcmdhd4361/wl_bam.c @@ -538,10 +538,10 @@ wl_adps_enabled(struct bcm_cfg80211 *cfg, struct net_device *ndev) data = (wl_adps_params_v1_t *)resp->data; if (data->mode) { - if (data->band == IEEE80211_BAND_2GHZ) { + if (data->band == NL80211_BAND_2GHZ) { band += WLC_BAND_2G; } - else if (data->band == IEEE80211_BAND_5GHZ) { + else if (data->band == NL80211_BAND_5GHZ) { band += WLC_BAND_5G; } } diff --git a/drivers/net/wireless/bcmdhd4361/wl_cfg80211.c b/drivers/net/wireless/bcmdhd4361/wl_cfg80211.c index 084c5034912e..0fd4ff1fefa7 100644 --- a/drivers/net/wireless/bcmdhd4361/wl_cfg80211.c +++ b/drivers/net/wireless/bcmdhd4361/wl_cfg80211.c @@ -1017,7 +1017,7 @@ struct chan_info { #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) */ #define CHAN2G(_channel, _freq, _flags) { \ - .band = IEEE80211_BAND_2GHZ, \ + .band = NL80211_BAND_2GHZ, \ .center_freq = (_freq), \ .hw_value = (_channel), \ .flags = (_flags), \ @@ -1026,7 +1026,7 @@ struct chan_info { } #define CHAN5G(_channel, _flags) { \ - .band = IEEE80211_BAND_5GHZ, \ + .band = NL80211_BAND_5GHZ, \ .center_freq = 5000 + (5 * (_channel)), \ .hw_value = (_channel), \ .flags = (_flags), \ @@ -1098,7 +1098,7 @@ static struct ieee80211_channel __wl_5ghz_a_channels[] = { }; static struct ieee80211_supported_band __wl_band_2ghz = { - .band = IEEE80211_BAND_2GHZ, + .band = NL80211_BAND_2GHZ, .channels = __wl_2ghz_channels, .n_channels = ARRAY_SIZE(__wl_2ghz_channels), .bitrates = wl_g_rates, @@ -1106,7 +1106,7 @@ static struct ieee80211_supported_band __wl_band_2ghz = { }; static struct ieee80211_supported_band __wl_band_5ghz_a = { - .band = IEEE80211_BAND_5GHZ, + .band = NL80211_BAND_5GHZ, .channels = __wl_5ghz_a_channels, .n_channels = ARRAY_SIZE(__wl_5ghz_a_channels), .bitrates = wl_a_rates, @@ -3107,7 +3107,7 @@ static void wl_scan_prep(struct bcm_cfg80211 *cfg, struct wl_scan_params *params continue; } - if (request->channels[i]->band == IEEE80211_BAND_2GHZ) { + if (request->channels[i]->band == NL80211_BAND_2GHZ) { #ifdef WL_HOST_BAND_MGMT if (cfg->curr_band == WLC_BAND_5G) { WL_DBG(("In 5G only mode, omit 2G channel:%d\n", channel)); @@ -4070,7 +4070,6 @@ channel_to_chanspec(struct wiphy *wiphy, struct net_device *dev, u32 channel, u3 int bw = 0, tmp_bw = 0; int i; u32 tmp_c; - #define LOCAL_BUF_SIZE 1024 buf = (u8 *)MALLOC(cfg->osh, LOCAL_BUF_SIZE); if (!buf) { @@ -5408,9 +5407,9 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, } if (chan) { - if (chan->band == IEEE80211_BAND_5GHZ) + if (chan->band == NL80211_BAND_5GHZ) param[0] = WLC_BAND_5G; - else if (chan->band == IEEE80211_BAND_2GHZ) + else if (chan->band == NL80211_BAND_2GHZ) param[0] = WLC_BAND_2G; err = wldev_iovar_getint(dev, "bw_cap", param); if (unlikely(err)) { @@ -9409,21 +9408,21 @@ wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, } #else u32 sta_band = (*sta_chan > CH_MAX_2G_CHANNEL) ? - IEEE80211_BAND_5GHZ : IEEE80211_BAND_2GHZ; + NL80211_BAND_5GHZ : NL80211_BAND_2GHZ; if (chan->band == sta_band) { - _chan = (sta_band == IEEE80211_BAND_5GHZ && + _chan = (sta_band == NL80211_BAND_5GHZ && *sta_chan != DEFAULT_5G_SOFTAP_CHANNEL) ? DEFAULT_2G_SOFTAP_CHANNEL : *sta_chan; } #endif /* WL_RESTRICTED_APSTA_SCC */ - _band = (_chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; + _band = (_chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; WL_ERR(("Target SoftAP channel will be set to %d\n", _chan)); } #undef DEFAULT_2G_SOFTAP_CHANNEL #undef DEFAULT_5G_SOFTAP_CHANNEL #endif /* APSTA_RESTRICTED_CHANNEL */ - if (_band == IEEE80211_BAND_5GHZ) { + if (_band == NL80211_BAND_5GHZ) { param.band = WLC_BAND_5G; err = wldev_iovar_getbuf(dev, "bw_cap", ¶m, sizeof(param), ioctl_buf, sizeof(ioctl_buf), NULL); @@ -9449,7 +9448,7 @@ wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev, } - } else if (_band == IEEE80211_BAND_2GHZ) + } else if (_band == NL80211_BAND_2GHZ) bw = WL_CHANSPEC_BW_20; set_channel: chspec = wf_channel2chspec(_chan, bw); @@ -11395,7 +11394,7 @@ wl_cfg80211_start_ap( } #ifdef SUPPORT_AP_RADIO_PWRSAVE - if ((dev_role == NL80211_IFTYPE_AP)) { + if (dev_role == NL80211_IFTYPE_AP) { if (!wl_set_ap_rps(dev, FALSE, dev->name)) { wl_cfg80211_init_ap_rps(cfg); } else { @@ -12184,7 +12183,7 @@ static int wl_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, if (!(dhd->op_mode & DHD_FLAG_HOSTAP_MODE)) { return -ENOENT; } - band = wiphy->bands[IEEE80211_BAND_2GHZ]; + band = wiphy->bands[NL80211_BAND_2GHZ]; if (band && idx >= band->n_channels) { idx -= band->n_channels; band = NULL; @@ -12192,7 +12191,7 @@ static int wl_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ndev, if (!band || idx >= band->n_channels) { /* Move to 5G band */ - band = wiphy->bands[IEEE80211_BAND_5GHZ]; + band = wiphy->bands[NL80211_BAND_5GHZ]; if (idx >= band->n_channels) { return -ENOENT; } @@ -12445,7 +12444,7 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev ARRAY_SIZE(common_iface_combinations); #endif /* LINUX_VER >= 3.0 && (WL_IFACE_COMB_NUM_CHANNELS || WL_CFG80211_P2P_DEV_IF) */ - wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; + wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz; wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wdev->wiphy->cipher_suites = __wl_cipher_suites; @@ -12708,9 +12707,9 @@ static s32 wl_inform_single_bss(struct bcm_cfg80211 *cfg, wl_bss_info_t *bi, boo wf_chspec_ctlchan(wl_chspec_driver_to_host(bi->chanspec)); if (notif_bss_info->channel <= CH_MAX_2G_CHANNEL) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; + band = wiphy->bands[NL80211_BAND_2GHZ]; else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; + band = wiphy->bands[NL80211_BAND_5GHZ]; if (!band) { WL_ERR(("No valid band")); MFREE(cfg->osh, notif_bss_info, sizeof(*notif_bss_info) @@ -13107,9 +13106,9 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev, channel = dtoh32(ci.hw_channel); if (channel <= CH_MAX_2G_CHANNEL) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; + band = wiphy->bands[NL80211_BAND_2GHZ]; else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; + band = wiphy->bands[NL80211_BAND_5GHZ]; if (!band) { WL_ERR(("No valid band")); if (body) { @@ -13324,7 +13323,7 @@ wl_notify_connect_status_ibss(struct bcm_cfg80211 *cfg, struct net_device *ndev, return err; } chan = wf_chspec_ctlchan(wl_chspec_driver_to_host(chanspec)); - band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; + band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(chan, band); channel = ieee80211_get_channel(wiphy, freq); #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) */ @@ -13524,9 +13523,9 @@ int wl_get_bss_info(struct bcm_cfg80211 *cfg, struct net_device *dev, struct eth freq = ieee80211_channel_to_frequency(channel); #else if (channel > 14) { - freq = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + freq = ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); } else { - freq = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + freq = ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); } #endif // endif rate = 0; @@ -14859,7 +14858,7 @@ static s32 wl_update_bss_info(struct bcm_cfg80211 *cfg, struct net_device *ndev, #if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS) freq = ieee80211_channel_to_frequency(channel); #else - band = (channel <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; + band = (channel <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); #endif // endif bss->channel = ieee80211_get_channel(wiphy, freq); @@ -14963,9 +14962,9 @@ wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev, #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || defined(WL_COMPAT_WIRELESS) /* channel info for cfg80211_roamed introduced in 2.6.39-rc1 */ if (*channel <= CH_MAX_2G_CHANNEL) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; + band = wiphy->bands[NL80211_BAND_2GHZ]; else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; + band = wiphy->bands[NL80211_BAND_5GHZ]; freq = ieee80211_channel_to_frequency(*channel, band->band); notify_channel = ieee80211_get_channel(wiphy, freq); #endif /* LINUX_VERSION > 2.6.39 || WL_COMPAT_WIRELESS */ @@ -15781,9 +15780,9 @@ _Pragma("GCC diagnostic pop") } if (channel <= CH_MAX_2G_CHANNEL) - band = wiphy->bands[IEEE80211_BAND_2GHZ]; + band = wiphy->bands[NL80211_BAND_2GHZ]; else - band = wiphy->bands[IEEE80211_BAND_5GHZ]; + band = wiphy->bands[NL80211_BAND_5GHZ]; if (!band) { WL_ERR(("No valid band")); return -EINVAL; @@ -18889,13 +18888,13 @@ static int wl_construct_reginfo(struct bcm_cfg80211 *cfg, s32 bw_cap) band_chan_arr = __wl_2ghz_channels; array_size = ARRAYSIZE(__wl_2ghz_channels); n_cnt = &n_2g; - band = IEEE80211_BAND_2GHZ; + band = NL80211_BAND_2GHZ; ht40_allowed = (bw_cap == WLC_N_BW_40ALL)? true : false; } else if (CHSPEC_IS5G(c) && channel >= CH_MIN_5G_CHANNEL) { band_chan_arr = __wl_5ghz_a_channels; array_size = ARRAYSIZE(__wl_5ghz_a_channels); n_cnt = &n_5g; - band = IEEE80211_BAND_5GHZ; + band = NL80211_BAND_5GHZ; ht40_allowed = (bw_cap == WLC_N_BW_20ALL)? false : true; } else { WL_ERR(("Invalid channel Sepc. 0x%x.\n", c)); @@ -18946,7 +18945,7 @@ static int wl_construct_reginfo(struct bcm_cfg80211 *cfg, s32 bw_cap) } else { band_chan_arr[index].flags = IEEE80211_CHAN_NO_HT40; if (!dfs_radar_disabled) { - if (band == IEEE80211_BAND_2GHZ) + if (band == NL80211_BAND_2GHZ) channel |= WL_CHANSPEC_BAND_2G; else channel |= WL_CHANSPEC_BAND_5G; @@ -19015,7 +19014,7 @@ static s32 __wl_update_wiphybands(struct bcm_cfg80211 *cfg, bool notify) #endif // endif s32 bw_cap = 0; s32 cur_band = -1; - struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS] = {NULL, }; + struct ieee80211_supported_band *bands[NUM_NL80211_BANDS] = {NULL, }; memset(bandlist, 0, sizeof(bandlist)); err = wldev_ioctl_get(dev, WLC_GET_BANDLIST, bandlist, @@ -19105,9 +19104,9 @@ static s32 __wl_update_wiphybands(struct bcm_cfg80211 *cfg, bool notify) for (i = 1; i <= nband && i < ARRAYSIZE(bandlist); i++) { index = -1; if (bandlist[i] == WLC_BAND_5G && __wl_band_5ghz_a.n_channels > 0) { - bands[IEEE80211_BAND_5GHZ] = + bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a; - index = IEEE80211_BAND_5GHZ; + index = NL80211_BAND_5GHZ; if (nmode && (bw_cap == WLC_N_BW_40ALL || bw_cap == WLC_N_BW_20IN2G_40IN5G)) bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; @@ -19197,9 +19196,9 @@ static s32 __wl_update_wiphybands(struct bcm_cfg80211 *cfg, bool notify) #endif // endif } else if (bandlist[i] == WLC_BAND_2G && __wl_band_2ghz.n_channels > 0) { - bands[IEEE80211_BAND_2GHZ] = + bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz; - index = IEEE80211_BAND_2GHZ; + index = NL80211_BAND_2GHZ; if (bw_cap == WLC_N_BW_40ALL) bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40; } @@ -19216,14 +19215,14 @@ static s32 __wl_update_wiphybands(struct bcm_cfg80211 *cfg, bool notify) } - wiphy->bands[IEEE80211_BAND_2GHZ] = bands[IEEE80211_BAND_2GHZ]; - wiphy->bands[IEEE80211_BAND_5GHZ] = bands[IEEE80211_BAND_5GHZ]; + wiphy->bands[NL80211_BAND_2GHZ] = bands[NL80211_BAND_2GHZ]; + wiphy->bands[NL80211_BAND_5GHZ] = bands[NL80211_BAND_5GHZ]; /* check if any bands populated otherwise makes 2Ghz as default */ - if (wiphy->bands[IEEE80211_BAND_2GHZ] == NULL && - wiphy->bands[IEEE80211_BAND_5GHZ] == NULL) { + if (wiphy->bands[NL80211_BAND_2GHZ] == NULL && + wiphy->bands[NL80211_BAND_5GHZ] == NULL) { /* Setup 2Ghz band as default */ - wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz; + wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz; } if (notify) @@ -20090,9 +20089,9 @@ s32 wl_cfg80211_channel_to_freq(u32 channel) { u16 band = 0; if (channel <= CH_MAX_2G_CHANNEL) - band = IEEE80211_BAND_2GHZ; + band = NL80211_BAND_2GHZ; else - band = IEEE80211_BAND_5GHZ; + band = NL80211_BAND_5GHZ; freq = ieee80211_channel_to_frequency(channel, band); } #endif // endif @@ -20626,7 +20625,7 @@ wl_cfg80211_get_best_channels(struct net_device *dev, char* cmd, int total_len) } if (CHANNEL_IS_2G(channel)) { - channel = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ); + channel = ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ); } else { WL_ERR(("invalid 2.4GHz channel, channel = %d\n", channel)); channel = 0; @@ -20649,7 +20648,7 @@ wl_cfg80211_get_best_channels(struct net_device *dev, char* cmd, int total_len) } if (CHANNEL_IS_5G(channel)) { - channel = ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ); + channel = ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ); } else { WL_ERR(("invalid 5GHz channel, channel = %d\n", channel)); channel = 0; @@ -23143,7 +23142,7 @@ wl_cfg80211_tdls_config(struct bcm_cfg80211 *cfg, enum wl_tdls_config state, boo /* Protect tdls config session */ mutex_lock(&cfg->tdls_sync); - if ((state == TDLS_STATE_TEARDOWN)) { + if (state == TDLS_STATE_TEARDOWN) { /* Host initiated TDLS tear down */ err = dhd_tdls_enable(ndev, false, auto_mode, NULL); goto exit; diff --git a/drivers/net/wireless/bcmdhd4361/wl_cfg80211.h b/drivers/net/wireless/bcmdhd4361/wl_cfg80211.h index 793575dd8ff8..c35541fd8647 100644 --- a/drivers/net/wireless/bcmdhd4361/wl_cfg80211.h +++ b/drivers/net/wireless/bcmdhd4361/wl_cfg80211.h @@ -77,8 +77,8 @@ struct wl_ibss; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) /* Newer kernels use defines from nl80211.h */ -#define IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ -#define IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ +#define NL80211_BAND_2GHZ NL80211_BAND_2GHZ +#define NL80211_BAND_5GHZ NL80211_BAND_5GHZ #define IEEE80211_NUM_BANDS NUM_NL80211_BANDS #endif /* LINUX_VER >= 4.7 */ diff --git a/drivers/net/wireless/bcmdhd4361/wl_cfgnan.c b/drivers/net/wireless/bcmdhd4361/wl_cfgnan.c index 5a54cbc77a03..f927d8ab7cff 100644 --- a/drivers/net/wireless/bcmdhd4361/wl_cfgnan.c +++ b/drivers/net/wireless/bcmdhd4361/wl_cfgnan.c @@ -2174,7 +2174,7 @@ wl_cfgnan_start_handler(struct net_device *ndev, struct bcm_cfg80211 *cfg, */ /* For Debug purpose, using clust id compulsion */ if (!ETHER_ISNULLADDR(&cmd_data->clus_id.octet)) { - if ((cmd_data->clus_id.octet[4] == cmd_data->clus_id.octet[5])) { + if (cmd_data->clus_id.octet[4] == cmd_data->clus_id.octet[5]) { /* device will merge to configured CID only */ ret = wl_cfgnan_config_control_flag(ndev, cfg, WL_NAN_CTRL_MERGE_CONF_CID_ONLY, &(cmd_data->status), true); diff --git a/drivers/net/wireless/bcmdhd4361/wl_cfgp2p.c b/drivers/net/wireless/bcmdhd4361/wl_cfgp2p.c index 71c80a624c3a..dba9a70fc016 100644 --- a/drivers/net/wireless/bcmdhd4361/wl_cfgp2p.c +++ b/drivers/net/wireless/bcmdhd4361/wl_cfgp2p.c @@ -729,7 +729,7 @@ wl_cfgp2p_init_discovery(struct bcm_cfg80211 *cfg) * so that time, the ifidx returned in WLC_E_IF should be used for populating * the netinfo */ - ret = wl_alloc_netinfo(cfg, NULL, cfg->p2p_wdev, WL_MODE_BSS, 0, bssidx, 0); + ret = wl_alloc_netinfo(cfg, NULL, cfg->p2p_wdev, WL_IF_TYPE_STA, 0, bssidx, 0); if (unlikely(ret)) { goto exit; } diff --git a/drivers/net/wireless/bcmdhd4361/wl_cfgvendor.c b/drivers/net/wireless/bcmdhd4361/wl_cfgvendor.c index d5350de3098c..dd915b9569b9 100644 --- a/drivers/net/wireless/bcmdhd4361/wl_cfgvendor.c +++ b/drivers/net/wireless/bcmdhd4361/wl_cfgvendor.c @@ -159,7 +159,7 @@ wl_cfgvendor_send_supp_eventstring(const char *func_name, const char *fmt, ...) int wl_cfgvendor_send_async_event(struct wiphy *wiphy, struct net_device *dev, int event_id, const void *data, int len) { - u16 kflags; + gfp_t kflags; struct sk_buff *skb; kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; @@ -4625,7 +4625,7 @@ wl_cfgvendor_send_nan_event(struct wiphy *wiphy, struct net_device *dev, { int ret = BCME_OK; int buf_len = NAN_EVENT_BUFFER_SIZE_LARGE; - u16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; + gfp_t kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); struct sk_buff *msg; diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index b5f3693fe5b6..89914d17f4ec 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -67,26 +67,6 @@ struct wiphy; * wireless hardware capability structures */ -/** - * enum ieee80211_band - supported frequency bands - * - * The bands are assigned this way because the supported - * bitrates differ in these bands. - * - * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band - * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) - * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz) - * @IEEE80211_NUM_BANDS: number of defined bands - */ -enum ieee80211_band { - IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, - IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, - IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ, - - /* keep last */ - IEEE80211_NUM_BANDS -}; - /** * enum ieee80211_channel_flags - channel flags * @@ -167,7 +147,7 @@ enum ieee80211_channel_flags { * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels. */ struct ieee80211_channel { - enum ieee80211_band band; + enum nl80211_band band; u16 center_freq; u16 hw_value; u32 flags; @@ -324,7 +304,7 @@ struct ieee80211_sta_vht_cap { struct ieee80211_supported_band { struct ieee80211_channel *channels; struct ieee80211_rate *bitrates; - enum ieee80211_band band; + enum nl80211_band band; int n_channels; int n_bitrates; struct ieee80211_sta_ht_cap ht_cap; @@ -1365,7 +1345,7 @@ struct mesh_setup { bool user_mpm; u8 dtim_period; u16 beacon_interval; - int mcast_rate[IEEE80211_NUM_BANDS]; + int mcast_rate[NUM_NL80211_BANDS]; u32 basic_rates; }; @@ -1462,7 +1442,7 @@ struct cfg80211_scan_request { size_t ie_len; u32 flags; - u32 rates[IEEE80211_NUM_BANDS]; + u32 rates[NUM_NL80211_BANDS]; struct wireless_dev *wdev; @@ -1848,7 +1828,7 @@ struct cfg80211_ibss_params { bool privacy; bool control_port; bool userspace_handles_dfs; - int mcast_rate[IEEE80211_NUM_BANDS]; + int mcast_rate[NUM_NL80211_BANDS]; struct ieee80211_ht_cap ht_capa; struct ieee80211_ht_cap ht_capa_mask; }; @@ -1939,7 +1919,7 @@ struct cfg80211_bitrate_mask { u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; u16 vht_mcs[NL80211_VHT_NSS_MAX]; enum nl80211_txrate_gi gi; - } control[IEEE80211_NUM_BANDS]; + } control[NUM_NL80211_BANDS]; }; /** * struct cfg80211_pmksa - PMK Security Association @@ -2613,7 +2593,7 @@ struct cfg80211_ops { int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev, - int rate[IEEE80211_NUM_BANDS]); + int rate[NUM_NL80211_BANDS]); int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); @@ -3256,7 +3236,7 @@ struct wiphy { * help determine whether you own this wiphy or not. */ const void *privid; - struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; + struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; /* Lets us get back the wiphy on the callback */ void (*reg_notifier)(struct wiphy *wiphy, @@ -3587,7 +3567,7 @@ static inline void *wdev_priv(struct wireless_dev *wdev) * @band: band, necessary due to channel number overlap * Return: The corresponding frequency (in MHz), or 0 if the conversion failed. */ -int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); +int ieee80211_channel_to_frequency(int chan, enum nl80211_band band); /** * ieee80211_frequency_to_channel - convert frequency to channel number @@ -5029,7 +5009,7 @@ void cfg80211_ch_switch_started_notify(struct net_device *dev, * Returns %true if the conversion was successful, %false otherwise. */ bool ieee80211_operating_class_to_band(u8 operating_class, - enum ieee80211_band *band); + enum nl80211_band *band); /** * ieee80211_chandef_to_operating_class - convert chandef to operation class diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 4e51f9a5a177..7a52fbf5c502 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -530,7 +530,7 @@ struct ieee80211_bss_conf { u8 sync_dtim_count; u32 basic_rates; struct ieee80211_rate *beacon_rate; - int mcast_rate[IEEE80211_NUM_BANDS]; + int mcast_rate[NUM_NL80211_BANDS]; u16 ht_operation_mode; s32 cqm_rssi_thold; u32 cqm_rssi_hyst; @@ -913,8 +913,8 @@ struct ieee80211_tx_info { * @common_ie_len: length of the common_ies */ struct ieee80211_scan_ies { - const u8 *ies[IEEE80211_NUM_BANDS]; - size_t len[IEEE80211_NUM_BANDS]; + const u8 *ies[NUM_NL80211_BANDS]; + size_t len[NUM_NL80211_BANDS]; const u8 *common_ies; size_t common_ie_len; }; @@ -1686,7 +1686,7 @@ struct ieee80211_sta_rates { * @txq: per-TID data TX queues (if driver uses the TXQ abstraction) */ struct ieee80211_sta { - u32 supp_rates[IEEE80211_NUM_BANDS]; + u32 supp_rates[NUM_NL80211_BANDS]; u8 addr[ETH_ALEN]; u16 aid; struct ieee80211_sta_ht_cap ht_cap; @@ -4296,7 +4296,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, */ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum ieee80211_band band, + enum nl80211_band band, size_t frame_len, struct ieee80211_rate *rate); @@ -5204,7 +5204,7 @@ struct rate_control_ops { }; static inline int rate_supported(struct ieee80211_sta *sta, - enum ieee80211_band band, + enum nl80211_band band, int index) { return (sta == NULL || sta->supp_rates[band] & BIT(index)); diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 4955cd7a1aba..92b1fc2a85e6 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -3600,11 +3600,15 @@ enum nl80211_txrate_gi { * @NL80211_BAND_2GHZ: 2.4 GHz ISM band * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz) * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz) + * @NUM_NL80211_BANDS: number of bands, avoid using this in userspace + * since newer kernel versions may support more bands */ enum nl80211_band { NL80211_BAND_2GHZ, NL80211_BAND_5GHZ, NL80211_BAND_60GHZ, + + NUM_NL80211_BANDS, }; /** diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 59cabc9bce69..a6631fb319c1 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -768,7 +768,7 @@ static bool cfg80211_ir_permissive_chan(struct wiphy *wiphy, if (chan == other_chan) return true; - if (chan->band != IEEE80211_BAND_5GHZ) + if (chan->band != NL80211_BAND_5GHZ) continue; r1 = cfg80211_get_unii(chan->center_freq); diff --git a/net/wireless/core.c b/net/wireless/core.c index 8f0bac7e03c4..c3dd4b2dca15 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -547,7 +547,7 @@ int wiphy_register(struct wiphy *wiphy) { struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); int res; - enum ieee80211_band band; + enum nl80211_band band; struct ieee80211_supported_band *sband; bool have_band = false; int i; @@ -630,7 +630,7 @@ int wiphy_register(struct wiphy *wiphy) return res; /* sanity check supported bands/channels */ - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { sband = wiphy->bands[band]; if (!sband) continue; @@ -642,7 +642,7 @@ int wiphy_register(struct wiphy *wiphy) * on 60GHz band, there are no legacy rates, so * n_bitrates is 0 */ - if (WARN_ON(band != IEEE80211_BAND_60GHZ && + if (WARN_ON(band != NL80211_BAND_60GHZ && !sband->n_bitrates)) return -EINVAL; @@ -652,7 +652,7 @@ int wiphy_register(struct wiphy *wiphy) * global structure for that. */ if (cfg80211_disable_40mhz_24ghz && - band == IEEE80211_BAND_2GHZ && + band == NL80211_BAND_2GHZ && sband->ht_cap.ht_supported) { sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c index 454157717efa..5d453916a417 100644 --- a/net/wireless/debugfs.c +++ b/net/wireless/debugfs.c @@ -69,7 +69,7 @@ static ssize_t ht40allow_map_read(struct file *file, struct wiphy *wiphy = file->private_data; char *buf; unsigned int offset = 0, buf_size = PAGE_SIZE, i, r; - enum ieee80211_band band; + enum nl80211_band band; struct ieee80211_supported_band *sband; buf = kzalloc(buf_size, GFP_KERNEL); @@ -78,7 +78,7 @@ static ssize_t ht40allow_map_read(struct file *file, rtnl_lock(); - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { sband = wiphy->bands[band]; if (!sband) continue; diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 4c55fab9b4e4..4a4dda53bdf1 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c @@ -104,7 +104,7 @@ static int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, struct ieee80211_supported_band *sband = rdev->wiphy.bands[params->chandef.chan->band]; int j; - u32 flag = params->chandef.chan->band == IEEE80211_BAND_5GHZ ? + u32 flag = params->chandef.chan->band == NL80211_BAND_5GHZ ? IEEE80211_RATE_MANDATORY_A : IEEE80211_RATE_MANDATORY_B; @@ -236,7 +236,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, struct wireless_dev *wdev) { struct cfg80211_cached_keys *ck = NULL; - enum ieee80211_band band; + enum nl80211_band band; int i, err; ASSERT_WDEV_LOCK(wdev); @@ -248,7 +248,7 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, if (!wdev->wext.ibss.chandef.chan) { struct ieee80211_channel *new_chan = NULL; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { struct ieee80211_supported_band *sband; struct ieee80211_channel *chan; diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c index 092300b30c37..fa2066b56f36 100644 --- a/net/wireless/mesh.c +++ b/net/wireless/mesh.c @@ -128,9 +128,9 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, if (!setup->chandef.chan) { /* if we don't have that either, use the first usable channel */ - enum ieee80211_band band; + enum nl80211_band band; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { struct ieee80211_supported_band *sband; struct ieee80211_channel *chan; int i; diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index c0e02f72e931..4f182812b22a 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -739,7 +739,7 @@ void cfg80211_dfs_channels_update_work(struct work_struct *work) wiphy = &rdev->wiphy; rtnl_lock(); - for (bandid = 0; bandid < IEEE80211_NUM_BANDS; bandid++) { + for (bandid = 0; bandid < NUM_NL80211_BANDS; bandid++) { sband = wiphy->bands[bandid]; if (!sband) continue; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4a396d234a0c..eb23d34e2eff 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -1257,7 +1257,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, struct nlattr *nl_bands, *nl_band; struct nlattr *nl_freqs, *nl_freq; struct nlattr *nl_cmds; - enum ieee80211_band band; + enum nl80211_band band; struct ieee80211_channel *chan; int i; const struct ieee80211_txrx_stypes *mgmt_stypes = @@ -1390,7 +1390,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, goto nla_put_failure; for (band = state->band_start; - band < IEEE80211_NUM_BANDS; band++) { + band < NUM_NL80211_BANDS; band++) { struct ieee80211_supported_band *sband; sband = rdev->wiphy.bands[band]; @@ -1452,7 +1452,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, } nla_nest_end(msg, nl_bands); - if (band < IEEE80211_NUM_BANDS) + if (band < NUM_NL80211_BANDS) state->band_start = band + 1; else state->band_start = 0; @@ -3598,7 +3598,7 @@ static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, struct nlattr *rate; u32 bitrate; u16 bitrate_compat; - enum nl80211_attrs rate_flg; + enum nl80211_rate_info rate_flg; rate = nla_nest_start(msg, attr); if (!rate) @@ -5867,10 +5867,10 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) i++; } } else { - enum ieee80211_band band; + enum nl80211_band band; /* all channels */ - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { int j; if (!wiphy->bands[band]) continue; @@ -5915,7 +5915,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) request->ie_len); } - for (i = 0; i < IEEE80211_NUM_BANDS; i++) + for (i = 0; i < NUM_NL80211_BANDS; i++) if (wiphy->bands[i]) request->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; @@ -5924,9 +5924,9 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SUPP_RATES], tmp) { - enum ieee80211_band band = nla_type(attr); + enum nl80211_band band = nla_type(attr); - if (band < 0 || band >= IEEE80211_NUM_BANDS) { + if (band < 0 || band >= NUM_NL80211_BANDS) { err = -EINVAL; goto out_free; } @@ -6090,7 +6090,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_sched_scan_request *request; struct nlattr *attr; int err, tmp, n_ssids = 0, n_match_sets = 0, n_channels, i, n_plans = 0; - enum ieee80211_band band; + enum nl80211_band band; size_t ie_len; struct nlattr *tb[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1]; s32 default_match_rssi = NL80211_SCAN_RSSI_THOLD_OFF; @@ -6255,7 +6255,7 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, } } else { /* all channels */ - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { int j; if (!wiphy->bands[band]) continue; @@ -7368,14 +7368,14 @@ static int nl80211_disassociate(struct sk_buff *skb, struct genl_info *info) static bool nl80211_parse_mcast_rate(struct cfg80211_registered_device *rdev, - int mcast_rate[IEEE80211_NUM_BANDS], + int mcast_rate[NUM_NL80211_BANDS], int rateval) { struct wiphy *wiphy = &rdev->wiphy; bool found = false; int band, i; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { struct ieee80211_supported_band *sband; sband = wiphy->bands[band]; @@ -7555,7 +7555,7 @@ static int nl80211_set_mcast_rate(struct sk_buff *skb, struct genl_info *info) { struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; - int mcast_rate[IEEE80211_NUM_BANDS]; + int mcast_rate[NUM_NL80211_BANDS]; u32 nla_rate; int err; @@ -8352,7 +8352,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, memset(&mask, 0, sizeof(mask)); /* Default to all rates enabled */ - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { + for (i = 0; i < NUM_NL80211_BANDS; i++) { sband = rdev->wiphy.bands[i]; if (!sband) @@ -8380,10 +8380,10 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, */ BUILD_BUG_ON(NL80211_MAX_SUPP_HT_RATES > IEEE80211_HT_MCS_MASK_LEN * 8); nla_for_each_nested(tx_rates, info->attrs[NL80211_ATTR_TX_RATES], rem) { - enum ieee80211_band band = nla_type(tx_rates); + enum nl80211_band band = nla_type(tx_rates); int err; - if (band < 0 || band >= IEEE80211_NUM_BANDS) + if (band < 0 || band >= NUM_NL80211_BANDS) return -EINVAL; sband = rdev->wiphy.bands[band]; if (sband == NULL) @@ -10545,7 +10545,7 @@ static int nl80211_tdls_channel_switch(struct sk_buff *skb, * section 10.22.6.2.1. Disallow 5/10Mhz channels as well for now, the * specification is not defined for them. */ - if (chandef.chan->band == IEEE80211_BAND_2GHZ && + if (chandef.chan->band == NL80211_BAND_2GHZ && chandef.width != NL80211_CHAN_WIDTH_20_NOHT && chandef.width != NL80211_CHAN_WIDTH_20) return -EINVAL; diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 71b52f85cc61..7bd0b029868a 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -1586,12 +1586,12 @@ static void reg_process_ht_flags_band(struct wiphy *wiphy, static void reg_process_ht_flags(struct wiphy *wiphy) { - enum ieee80211_band band; + enum nl80211_band band; if (!wiphy) return; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) + for (band = 0; band < NUM_NL80211_BANDS; band++) reg_process_ht_flags_band(wiphy, wiphy->bands[band]); } @@ -1713,7 +1713,7 @@ static void reg_check_channels(void) static void wiphy_update_regulatory(struct wiphy *wiphy, enum nl80211_reg_initiator initiator) { - enum ieee80211_band band; + enum nl80211_band band; struct regulatory_request *lr = get_last_request(); if (ignore_reg_update(wiphy, initiator)) { @@ -1730,7 +1730,7 @@ static void wiphy_update_regulatory(struct wiphy *wiphy, lr->dfs_region = get_cfg80211_regdom()->dfs_region; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) + for (band = 0; band < NUM_NL80211_BANDS; band++) handle_band(wiphy, initiator, wiphy->bands[band]); reg_process_beacons(wiphy); @@ -1855,14 +1855,14 @@ static void handle_band_custom(struct wiphy *wiphy, void wiphy_apply_custom_regulatory(struct wiphy *wiphy, const struct ieee80211_regdomain *regd) { - enum ieee80211_band band; + enum nl80211_band band; unsigned int bands_set = 0; WARN(!(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG), "wiphy should have REGULATORY_CUSTOM_REG\n"); wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { if (!wiphy->bands[band]) continue; handle_band_custom(wiphy, wiphy->bands[band], regd); @@ -2309,7 +2309,7 @@ static void reg_process_self_managed_hints(void) struct wiphy *wiphy; const struct ieee80211_regdomain *tmp; const struct ieee80211_regdomain *regd; - enum ieee80211_band band; + enum nl80211_band band; struct regulatory_request request = {}; list_for_each_entry(rdev, &cfg80211_rdev_list, list) { @@ -2327,7 +2327,7 @@ static void reg_process_self_managed_hints(void) rcu_assign_pointer(wiphy->regd, regd); rcu_free_regdom(tmp); - for (band = 0; band < IEEE80211_NUM_BANDS; band++) + for (band = 0; band < NUM_NL80211_BANDS; band++) handle_band_custom(wiphy, wiphy->bands[band], regd); reg_process_ht_flags(wiphy); @@ -2499,7 +2499,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2) } EXPORT_SYMBOL(regulatory_hint); -void regulatory_hint_country_ie(struct wiphy *wiphy, enum ieee80211_band band, +void regulatory_hint_country_ie(struct wiphy *wiphy, enum nl80211_band band, const u8 *country_ie, u8 country_ie_len) { char alpha2[2]; @@ -2599,11 +2599,11 @@ static void restore_alpha2(char *alpha2, bool reset_user) static void restore_custom_reg_settings(struct wiphy *wiphy) { struct ieee80211_supported_band *sband; - enum ieee80211_band band; + enum nl80211_band band; struct ieee80211_channel *chan; int i; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { sband = wiphy->bands[band]; if (!sband) continue; @@ -2730,9 +2730,9 @@ void regulatory_hint_disconnect(void) static bool freq_is_chan_12_13_14(u16 freq) { - if (freq == ieee80211_channel_to_frequency(12, IEEE80211_BAND_2GHZ) || - freq == ieee80211_channel_to_frequency(13, IEEE80211_BAND_2GHZ) || - freq == ieee80211_channel_to_frequency(14, IEEE80211_BAND_2GHZ)) + if (freq == ieee80211_channel_to_frequency(12, NL80211_BAND_2GHZ) || + freq == ieee80211_channel_to_frequency(13, NL80211_BAND_2GHZ) || + freq == ieee80211_channel_to_frequency(14, NL80211_BAND_2GHZ)) return true; return false; } @@ -2768,7 +2768,7 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy, if (beacon_chan->beacon_found || beacon_chan->flags & IEEE80211_CHAN_RADAR || - (beacon_chan->band == IEEE80211_BAND_2GHZ && + (beacon_chan->band == NL80211_BAND_2GHZ && !freq_is_chan_12_13_14(beacon_chan->center_freq))) return 0; diff --git a/net/wireless/reg.h b/net/wireless/reg.h index 9f495d76eca0..f6ced316b5a4 100644 --- a/net/wireless/reg.h +++ b/net/wireless/reg.h @@ -104,7 +104,7 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy, * information for a band the BSS is not present in it will be ignored. */ void regulatory_hint_country_ie(struct wiphy *wiphy, - enum ieee80211_band band, + enum nl80211_band band, const u8 *country_ie, u8 country_ie_len); diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 6e35911bf524..fc2843a52846 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -606,7 +606,7 @@ static int cmp_bss(struct cfg80211_bss *a, } static bool cfg80211_bss_type_match(u16 capability, - enum ieee80211_band band, + enum nl80211_band band, enum ieee80211_bss_type bss_type) { bool ret = true; @@ -615,7 +615,7 @@ static bool cfg80211_bss_type_match(u16 capability, if (bss_type == IEEE80211_BSS_TYPE_ANY) return ret; - if (band == IEEE80211_BAND_60GHZ) { + if (band == NL80211_BAND_60GHZ) { mask = WLAN_CAPABILITY_DMG_TYPE_MASK; switch (bss_type) { case IEEE80211_BSS_TYPE_ESS: @@ -1099,7 +1099,7 @@ cfg80211_inform_bss_data(struct wiphy *wiphy, if (!res) return NULL; - if (channel->band == IEEE80211_BAND_60GHZ) { + if (channel->band == NL80211_BAND_60GHZ) { bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK; if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP || bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS) @@ -1182,7 +1182,7 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, if (!res) return NULL; - if (channel->band == IEEE80211_BAND_60GHZ) { + if (channel->band == NL80211_BAND_60GHZ) { bss_type = res->pub.capability & WLAN_CAPABILITY_DMG_TYPE_MASK; if (bss_type == WLAN_CAPABILITY_DMG_TYPE_AP || bss_type == WLAN_CAPABILITY_DMG_TYPE_PBSS) @@ -1278,7 +1278,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, struct iw_scan_req *wreq = NULL; struct cfg80211_scan_request *creq = NULL; int i, err, n_channels = 0; - enum ieee80211_band band; + enum nl80211_band band; if (!netif_running(dev)) return -ENETDOWN; @@ -1322,7 +1322,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, /* translate "Scan on frequencies" request */ i = 0; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { int j; if (!wiphy->bands[band]) @@ -1382,7 +1382,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, creq->n_ssids = 0; } - for (i = 0; i < IEEE80211_NUM_BANDS; i++) + for (i = 0; i < NUM_NL80211_BANDS; i++) if (wiphy->bands[i]) creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 18b4a652cf41..d7a66d8742ed 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -82,7 +82,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev) return -ENOMEM; if (wdev->conn->params.channel) { - enum ieee80211_band band = wdev->conn->params.channel->band; + enum nl80211_band band = wdev->conn->params.channel->band; struct ieee80211_supported_band *sband = wdev->wiphy->bands[band]; @@ -94,11 +94,11 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev) request->rates[band] = (1 << sband->n_bitrates) - 1; } else { int i = 0, j; - enum ieee80211_band band; + enum nl80211_band band; struct ieee80211_supported_band *bands; struct ieee80211_channel *channel; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { bands = wdev->wiphy->bands[band]; if (!bands) continue; diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 0c392d36781b..dfdb234d4634 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -110,7 +110,7 @@ conf->dot11MeshHWMPconfirmationInterval; \ } while (0) -#define CHAN_ENTRY __field(enum ieee80211_band, band) \ +#define CHAN_ENTRY __field(enum nl80211_band, band) \ __field(u16, center_freq) #define CHAN_ASSIGN(chan) \ do { \ @@ -125,7 +125,7 @@ #define CHAN_PR_FMT "band: %d, freq: %u" #define CHAN_PR_ARG __entry->band, __entry->center_freq -#define CHAN_DEF_ENTRY __field(enum ieee80211_band, band) \ +#define CHAN_DEF_ENTRY __field(enum nl80211_band, band) \ __field(u32, control_freq) \ __field(u32, width) \ __field(u32, center_freq1) \ @@ -2607,7 +2607,7 @@ TRACE_EVENT(cfg80211_scan_done, TP_STRUCT__entry( __field(u32, n_channels) __dynamic_array(u8, ie, request ? request->ie_len : 0) - __array(u32, rates, IEEE80211_NUM_BANDS) + __array(u32, rates, NUM_NL80211_BANDS) __field(u32, wdev_id) MAC_ENTRY(wiphy_mac) __field(bool, no_cck) @@ -2618,7 +2618,7 @@ TRACE_EVENT(cfg80211_scan_done, memcpy(__get_dynamic_array(ie), request->ie, request->ie_len); memcpy(__entry->rates, request->rates, - IEEE80211_NUM_BANDS); + NUM_NL80211_BANDS); __entry->wdev_id = request->wdev ? request->wdev->identifier : 0; if (request->wiphy) diff --git a/net/wireless/util.c b/net/wireless/util.c index baf7218cec15..efd2a52d151f 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -47,7 +47,7 @@ u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, if (WARN_ON(!sband)) return 1; - if (sband->band == IEEE80211_BAND_2GHZ) { + if (sband->band == NL80211_BAND_2GHZ) { if (scan_width == NL80211_BSS_CHAN_WIDTH_5 || scan_width == NL80211_BSS_CHAN_WIDTH_10) mandatory_flag = IEEE80211_RATE_MANDATORY_G; @@ -65,26 +65,26 @@ u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband, } EXPORT_SYMBOL(ieee80211_mandatory_rates); -int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band) +int ieee80211_channel_to_frequency(int chan, enum nl80211_band band) { /* see 802.11 17.3.8.3.2 and Annex J * there are overlapping channel numbers in 5GHz and 2GHz bands */ if (chan <= 0) return 0; /* not supported */ switch (band) { - case IEEE80211_BAND_2GHZ: + case NL80211_BAND_2GHZ: if (chan == 14) return 2484; else if (chan < 14) return 2407 + chan * 5; break; - case IEEE80211_BAND_5GHZ: + case NL80211_BAND_5GHZ: if (chan >= 182 && chan <= 196) return 4000 + chan * 5; else return 5000 + chan * 5; break; - case IEEE80211_BAND_60GHZ: + case NL80211_BAND_60GHZ: if (chan < 5) return 56160 + chan * 2160; break; @@ -116,11 +116,11 @@ EXPORT_SYMBOL(ieee80211_frequency_to_channel); struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, int freq) { - enum ieee80211_band band; + enum nl80211_band band; struct ieee80211_supported_band *sband; int i; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { sband = wiphy->bands[band]; if (!sband) @@ -137,12 +137,12 @@ struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, EXPORT_SYMBOL(__ieee80211_get_channel); static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, - enum ieee80211_band band) + enum nl80211_band band) { int i, want; switch (band) { - case IEEE80211_BAND_5GHZ: + case NL80211_BAND_5GHZ: want = 3; for (i = 0; i < sband->n_bitrates; i++) { if (sband->bitrates[i].bitrate == 60 || @@ -155,7 +155,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, } WARN_ON(want); break; - case IEEE80211_BAND_2GHZ: + case NL80211_BAND_2GHZ: want = 7; for (i = 0; i < sband->n_bitrates; i++) { if (sband->bitrates[i].bitrate == 10) { @@ -185,12 +185,12 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, } WARN_ON(want != 0 && want != 3 && want != 6); break; - case IEEE80211_BAND_60GHZ: + case NL80211_BAND_60GHZ: /* check for mandatory HT MCS 1..4 */ WARN_ON(!sband->ht_cap.ht_supported); WARN_ON((sband->ht_cap.mcs.rx_mask[0] & 0x1e) != 0x1e); break; - case IEEE80211_NUM_BANDS: + case NUM_NL80211_BANDS: WARN_ON(1); break; } @@ -198,9 +198,9 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, void ieee80211_set_bitrate_flags(struct wiphy *wiphy) { - enum ieee80211_band band; + enum nl80211_band band; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) + for (band = 0; band < NUM_NL80211_BANDS; band++) if (wiphy->bands[band]) set_mandatory_flags_band(wiphy->bands[band], band); } @@ -1333,22 +1333,22 @@ size_t ieee80211_ie_split(const u8 *ies, size_t ielen, EXPORT_SYMBOL(ieee80211_ie_split); bool ieee80211_operating_class_to_band(u8 operating_class, - enum ieee80211_band *band) + enum nl80211_band *band) { switch (operating_class) { case 112: case 115 ... 127: case 128 ... 130: - *band = IEEE80211_BAND_5GHZ; + *band = NL80211_BAND_5GHZ; return true; case 81: case 82: case 83: case 84: - *band = IEEE80211_BAND_2GHZ; + *band = NL80211_BAND_2GHZ; return true; case 180: - *band = IEEE80211_BAND_60GHZ; + *band = NL80211_BAND_60GHZ; return true; } @@ -1774,10 +1774,10 @@ int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy) { - enum ieee80211_band band; + enum nl80211_band band; unsigned int n_channels = 0; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) + for (band = 0; band < NUM_NL80211_BANDS; band++) if (wiphy->bands[band]) n_channels += wiphy->bands[band]->n_channels; diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index fd682832a0e3..4c89f0ca61ba 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c @@ -32,13 +32,13 @@ int cfg80211_wext_giwname(struct net_device *dev, if (!wdev) return -EOPNOTSUPP; - sband = wdev->wiphy->bands[IEEE80211_BAND_5GHZ]; + sband = wdev->wiphy->bands[NL80211_BAND_5GHZ]; if (sband) { is_a = true; is_ht |= sband->ht_cap.ht_supported; } - sband = wdev->wiphy->bands[IEEE80211_BAND_2GHZ]; + sband = wdev->wiphy->bands[NL80211_BAND_2GHZ]; if (sband) { int i; /* Check for mandatory rates */ @@ -143,7 +143,7 @@ int cfg80211_wext_giwrange(struct net_device *dev, { struct wireless_dev *wdev = dev->ieee80211_ptr; struct iw_range *range = (struct iw_range *) extra; - enum ieee80211_band band; + enum nl80211_band band; int i, c = 0; if (!wdev) @@ -215,7 +215,7 @@ int cfg80211_wext_giwrange(struct net_device *dev, } } - for (band = 0; band < IEEE80211_NUM_BANDS; band ++) { + for (band = 0; band < NUM_NL80211_BANDS; band ++) { struct ieee80211_supported_band *sband; sband = wdev->wiphy->bands[band]; @@ -265,11 +265,11 @@ int cfg80211_wext_freq(struct iw_freq *freq) * -EINVAL for impossible things. */ if (freq->e == 0) { - enum ieee80211_band band = IEEE80211_BAND_2GHZ; + enum nl80211_band band = NL80211_BAND_2GHZ; if (freq->m < 0) return 0; if (freq->m > 14) - band = IEEE80211_BAND_5GHZ; + band = NL80211_BAND_5GHZ; return ieee80211_channel_to_frequency(freq->m, band); } else { int i, div = 1000000; @@ -1245,7 +1245,7 @@ static int cfg80211_wext_siwrate(struct net_device *dev, maxrate = rate->value / 100000; } - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { + for (band = 0; band < NUM_NL80211_BANDS; band++) { sband = wdev->wiphy->bands[band]; if (sband == NULL) continue; -- 2.20.1