| .. | .. |
|---|
| 1 | | -/****************************************************************************** |
|---|
| 2 | | - * |
|---|
| 3 | | - * Copyright(c) 2009-2012 Realtek Corporation. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms of version 2 of the GNU General Public License as |
|---|
| 7 | | - * published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - * more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * The full GNU General Public License is included in this distribution in the |
|---|
| 15 | | - * file called LICENSE. |
|---|
| 16 | | - * |
|---|
| 17 | | - * Contact Information: |
|---|
| 18 | | - * wlanfae <wlanfae@realtek.com> |
|---|
| 19 | | - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, |
|---|
| 20 | | - * Hsinchu 300, Taiwan. |
|---|
| 21 | | - * |
|---|
| 22 | | - * Larry Finger <Larry.Finger@lwfinger.net> |
|---|
| 23 | | - * |
|---|
| 24 | | - *****************************************************************************/ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 2 | +/* Copyright(c) 2009-2012 Realtek Corporation.*/ |
|---|
| 25 | 3 | |
|---|
| 26 | 4 | #include "wifi.h" |
|---|
| 27 | 5 | #include "regd.h" |
|---|
| 28 | 6 | |
|---|
| 29 | | -static struct country_code_to_enum_rd allCountries[] = { |
|---|
| 7 | +static struct country_code_to_enum_rd all_countries[] = { |
|---|
| 30 | 8 | {COUNTRY_CODE_FCC, "US"}, |
|---|
| 31 | 9 | {COUNTRY_CODE_IC, "US"}, |
|---|
| 32 | 10 | {COUNTRY_CODE_ETSI, "EC"}, |
|---|
| .. | .. |
|---|
| 62 | 40 | REG_RULE(2484-10, 2484+10, 40, 0, 20, \ |
|---|
| 63 | 41 | NL80211_RRF_PASSIVE_SCAN | \ |
|---|
| 64 | 42 | NL80211_RRF_NO_OFDM) |
|---|
| 65 | | - |
|---|
| 66 | 43 | |
|---|
| 67 | 44 | /* 5G chan 36 - chan 64*/ |
|---|
| 68 | 45 | #define RTL819x_5GHZ_5150_5350 \ |
|---|
| .. | .. |
|---|
| 299 | 276 | return; |
|---|
| 300 | 277 | } |
|---|
| 301 | 278 | |
|---|
| 302 | | -static void _rtl_dump_channel_map(struct wiphy *wiphy) |
|---|
| 303 | | -{ |
|---|
| 304 | | - enum nl80211_band band; |
|---|
| 305 | | - struct ieee80211_supported_band *sband; |
|---|
| 306 | | - struct ieee80211_channel *ch; |
|---|
| 307 | | - unsigned int i; |
|---|
| 308 | | - |
|---|
| 309 | | - for (band = 0; band < NUM_NL80211_BANDS; band++) { |
|---|
| 310 | | - if (!wiphy->bands[band]) |
|---|
| 311 | | - continue; |
|---|
| 312 | | - sband = wiphy->bands[band]; |
|---|
| 313 | | - for (i = 0; i < sband->n_channels; i++) |
|---|
| 314 | | - ch = &sband->channels[i]; |
|---|
| 315 | | - } |
|---|
| 316 | | -} |
|---|
| 317 | | - |
|---|
| 318 | 279 | static int _rtl_reg_notifier_apply(struct wiphy *wiphy, |
|---|
| 319 | 280 | struct regulatory_request *request, |
|---|
| 320 | 281 | struct rtl_regulatory *reg) |
|---|
| .. | .. |
|---|
| 331 | 292 | _rtl_reg_apply_world_flags(wiphy, request->initiator, reg); |
|---|
| 332 | 293 | break; |
|---|
| 333 | 294 | } |
|---|
| 334 | | - |
|---|
| 335 | | - _rtl_dump_channel_map(wiphy); |
|---|
| 336 | 295 | |
|---|
| 337 | 296 | return 0; |
|---|
| 338 | 297 | } |
|---|
| .. | .. |
|---|
| 391 | 350 | { |
|---|
| 392 | 351 | int i; |
|---|
| 393 | 352 | |
|---|
| 394 | | - for (i = 0; i < ARRAY_SIZE(allCountries); i++) { |
|---|
| 395 | | - if (allCountries[i].countrycode == countrycode) |
|---|
| 396 | | - return &allCountries[i]; |
|---|
| 353 | + for (i = 0; i < ARRAY_SIZE(all_countries); i++) { |
|---|
| 354 | + if (all_countries[i].countrycode == countrycode) |
|---|
| 355 | + return &all_countries[i]; |
|---|
| 397 | 356 | } |
|---|
| 398 | 357 | return NULL; |
|---|
| 399 | 358 | } |
|---|
| .. | .. |
|---|
| 434 | 393 | rtlpriv->regd.country_code = |
|---|
| 435 | 394 | channel_plan_to_country_code(rtlpriv->efuse.channel_plan); |
|---|
| 436 | 395 | |
|---|
| 437 | | - RT_TRACE(rtlpriv, COMP_REGD, DBG_DMESG, |
|---|
| 438 | | - "rtl: EEPROM regdomain: 0x%0x country code: %d\n", |
|---|
| 439 | | - rtlpriv->efuse.channel_plan, rtlpriv->regd.country_code); |
|---|
| 396 | + rtl_dbg(rtlpriv, COMP_REGD, DBG_DMESG, |
|---|
| 397 | + "rtl: EEPROM regdomain: 0x%0x country code: %d\n", |
|---|
| 398 | + rtlpriv->efuse.channel_plan, rtlpriv->regd.country_code); |
|---|
| 440 | 399 | |
|---|
| 441 | 400 | if (rtlpriv->regd.country_code >= COUNTRY_CODE_MAX) { |
|---|
| 442 | | - RT_TRACE(rtlpriv, COMP_REGD, DBG_DMESG, |
|---|
| 443 | | - "rtl: EEPROM indicates invalid country code, world wide 13 should be used\n"); |
|---|
| 401 | + rtl_dbg(rtlpriv, COMP_REGD, DBG_DMESG, |
|---|
| 402 | + "rtl: EEPROM indicates invalid country code, world wide 13 should be used\n"); |
|---|
| 444 | 403 | |
|---|
| 445 | 404 | rtlpriv->regd.country_code = COUNTRY_CODE_WORLD_WIDE_13; |
|---|
| 446 | 405 | } |
|---|
| .. | .. |
|---|
| 455 | 414 | rtlpriv->regd.alpha2[1] = '0'; |
|---|
| 456 | 415 | } |
|---|
| 457 | 416 | |
|---|
| 458 | | - RT_TRACE(rtlpriv, COMP_REGD, DBG_TRACE, |
|---|
| 459 | | - "rtl: Country alpha2 being used: %c%c\n", |
|---|
| 460 | | - rtlpriv->regd.alpha2[0], rtlpriv->regd.alpha2[1]); |
|---|
| 417 | + rtl_dbg(rtlpriv, COMP_REGD, DBG_TRACE, |
|---|
| 418 | + "rtl: Country alpha2 being used: %c%c\n", |
|---|
| 419 | + rtlpriv->regd.alpha2[0], rtlpriv->regd.alpha2[1]); |
|---|
| 461 | 420 | |
|---|
| 462 | 421 | _rtl_regd_init_wiphy(&rtlpriv->regd, wiphy, reg_notifier); |
|---|
| 463 | 422 | |
|---|
| .. | .. |
|---|
| 469 | 428 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
|---|
| 470 | 429 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
|---|
| 471 | 430 | |
|---|
| 472 | | - RT_TRACE(rtlpriv, COMP_REGD, DBG_LOUD, "\n"); |
|---|
| 431 | + rtl_dbg(rtlpriv, COMP_REGD, DBG_LOUD, "\n"); |
|---|
| 473 | 432 | |
|---|
| 474 | 433 | _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd); |
|---|
| 475 | 434 | } |
|---|