.. | .. |
---|
1581 | 1581 | } |
---|
1582 | 1582 | |
---|
1583 | 1583 | /* string is in decimal */ |
---|
1584 | | -static bool _rtl8812ae_get_integer_from_string(char *str, u8 *pint) |
---|
| 1584 | +static bool _rtl8812ae_get_integer_from_string(const char *str, u8 *pint) |
---|
1585 | 1585 | { |
---|
1586 | 1586 | u16 i = 0; |
---|
1587 | 1587 | *pint = 0; |
---|
.. | .. |
---|
1596 | 1596 | ++i; |
---|
1597 | 1597 | } |
---|
1598 | 1598 | |
---|
1599 | | - return true; |
---|
1600 | | -} |
---|
1601 | | - |
---|
1602 | | -static bool _rtl8812ae_eq_n_byte(u8 *str1, u8 *str2, u32 num) |
---|
1603 | | -{ |
---|
1604 | | - if (num == 0) |
---|
1605 | | - return false; |
---|
1606 | | - while (num > 0) { |
---|
1607 | | - num--; |
---|
1608 | | - if (str1[num] != str2[num]) |
---|
1609 | | - return false; |
---|
1610 | | - } |
---|
1611 | 1599 | return true; |
---|
1612 | 1600 | } |
---|
1613 | 1601 | |
---|
.. | .. |
---|
1637 | 1625 | return channel_index; |
---|
1638 | 1626 | } |
---|
1639 | 1627 | |
---|
1640 | | -static void _rtl8812ae_phy_set_txpower_limit(struct ieee80211_hw *hw, u8 *pregulation, |
---|
1641 | | - u8 *pband, u8 *pbandwidth, |
---|
1642 | | - u8 *prate_section, u8 *prf_path, |
---|
1643 | | - u8 *pchannel, u8 *ppower_limit) |
---|
| 1628 | +static void _rtl8812ae_phy_set_txpower_limit(struct ieee80211_hw *hw, |
---|
| 1629 | + const char *pregulation, |
---|
| 1630 | + const char *pband, const char *pbandwidth, |
---|
| 1631 | + const char *prate_section, const char *prf_path, |
---|
| 1632 | + const char *pchannel, const char *ppower_limit) |
---|
1644 | 1633 | { |
---|
1645 | 1634 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
---|
1646 | 1635 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
---|
.. | .. |
---|
1648 | 1637 | u8 channel_index; |
---|
1649 | 1638 | s8 power_limit = 0, prev_power_limit, ret; |
---|
1650 | 1639 | |
---|
1651 | | - if (!_rtl8812ae_get_integer_from_string((char *)pchannel, &channel) || |
---|
1652 | | - !_rtl8812ae_get_integer_from_string((char *)ppower_limit, |
---|
| 1640 | + if (!_rtl8812ae_get_integer_from_string(pchannel, &channel) || |
---|
| 1641 | + !_rtl8812ae_get_integer_from_string(ppower_limit, |
---|
1653 | 1642 | &power_limit)) { |
---|
1654 | 1643 | rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, |
---|
1655 | 1644 | "Illegal index of pwr_lmt table [chnl %d][val %d]\n", |
---|
.. | .. |
---|
1659 | 1648 | power_limit = power_limit > MAX_POWER_INDEX ? |
---|
1660 | 1649 | MAX_POWER_INDEX : power_limit; |
---|
1661 | 1650 | |
---|
1662 | | - if (_rtl8812ae_eq_n_byte(pregulation, (u8 *)("FCC"), 3)) |
---|
| 1651 | + if (strcmp(pregulation, "FCC") == 0) |
---|
1663 | 1652 | regulation = 0; |
---|
1664 | | - else if (_rtl8812ae_eq_n_byte(pregulation, (u8 *)("MKK"), 3)) |
---|
| 1653 | + else if (strcmp(pregulation, "MKK") == 0) |
---|
1665 | 1654 | regulation = 1; |
---|
1666 | | - else if (_rtl8812ae_eq_n_byte(pregulation, (u8 *)("ETSI"), 4)) |
---|
| 1655 | + else if (strcmp(pregulation, "ETSI") == 0) |
---|
1667 | 1656 | regulation = 2; |
---|
1668 | | - else if (_rtl8812ae_eq_n_byte(pregulation, (u8 *)("WW13"), 4)) |
---|
| 1657 | + else if (strcmp(pregulation, "WW13") == 0) |
---|
1669 | 1658 | regulation = 3; |
---|
1670 | 1659 | |
---|
1671 | | - if (_rtl8812ae_eq_n_byte(prate_section, (u8 *)("CCK"), 3)) |
---|
| 1660 | + if (strcmp(prate_section, "CCK") == 0) |
---|
1672 | 1661 | rate_section = 0; |
---|
1673 | | - else if (_rtl8812ae_eq_n_byte(prate_section, (u8 *)("OFDM"), 4)) |
---|
| 1662 | + else if (strcmp(prate_section, "OFDM") == 0) |
---|
1674 | 1663 | rate_section = 1; |
---|
1675 | | - else if (_rtl8812ae_eq_n_byte(prate_section, (u8 *)("HT"), 2) && |
---|
1676 | | - _rtl8812ae_eq_n_byte(prf_path, (u8 *)("1T"), 2)) |
---|
| 1664 | + else if (strcmp(prate_section, "HT") == 0 && |
---|
| 1665 | + strcmp(prf_path, "1T") == 0) |
---|
1677 | 1666 | rate_section = 2; |
---|
1678 | | - else if (_rtl8812ae_eq_n_byte(prate_section, (u8 *)("HT"), 2) && |
---|
1679 | | - _rtl8812ae_eq_n_byte(prf_path, (u8 *)("2T"), 2)) |
---|
| 1667 | + else if (strcmp(prate_section, "HT") == 0 && |
---|
| 1668 | + strcmp(prf_path, "2T") == 0) |
---|
1680 | 1669 | rate_section = 3; |
---|
1681 | | - else if (_rtl8812ae_eq_n_byte(prate_section, (u8 *)("VHT"), 3) && |
---|
1682 | | - _rtl8812ae_eq_n_byte(prf_path, (u8 *)("1T"), 2)) |
---|
| 1670 | + else if (strcmp(prate_section, "VHT") == 0 && |
---|
| 1671 | + strcmp(prf_path, "1T") == 0) |
---|
1683 | 1672 | rate_section = 4; |
---|
1684 | | - else if (_rtl8812ae_eq_n_byte(prate_section, (u8 *)("VHT"), 3) && |
---|
1685 | | - _rtl8812ae_eq_n_byte(prf_path, (u8 *)("2T"), 2)) |
---|
| 1673 | + else if (strcmp(prate_section, "VHT") == 0 && |
---|
| 1674 | + strcmp(prf_path, "2T") == 0) |
---|
1686 | 1675 | rate_section = 5; |
---|
1687 | 1676 | |
---|
1688 | | - if (_rtl8812ae_eq_n_byte(pbandwidth, (u8 *)("20M"), 3)) |
---|
| 1677 | + if (strcmp(pbandwidth, "20M") == 0) |
---|
1689 | 1678 | bandwidth = 0; |
---|
1690 | | - else if (_rtl8812ae_eq_n_byte(pbandwidth, (u8 *)("40M"), 3)) |
---|
| 1679 | + else if (strcmp(pbandwidth, "40M") == 0) |
---|
1691 | 1680 | bandwidth = 1; |
---|
1692 | | - else if (_rtl8812ae_eq_n_byte(pbandwidth, (u8 *)("80M"), 3)) |
---|
| 1681 | + else if (strcmp(pbandwidth, "80M") == 0) |
---|
1693 | 1682 | bandwidth = 2; |
---|
1694 | | - else if (_rtl8812ae_eq_n_byte(pbandwidth, (u8 *)("160M"), 4)) |
---|
| 1683 | + else if (strcmp(pbandwidth, "160M") == 0) |
---|
1695 | 1684 | bandwidth = 3; |
---|
1696 | 1685 | |
---|
1697 | | - if (_rtl8812ae_eq_n_byte(pband, (u8 *)("2.4G"), 4)) { |
---|
| 1686 | + if (strcmp(pband, "2.4G") == 0) { |
---|
1698 | 1687 | ret = _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt(hw, |
---|
1699 | 1688 | BAND_ON_2_4G, |
---|
1700 | 1689 | channel); |
---|
.. | .. |
---|
1718 | 1707 | regulation, bandwidth, rate_section, channel_index, |
---|
1719 | 1708 | rtlphy->txpwr_limit_2_4g[regulation][bandwidth] |
---|
1720 | 1709 | [rate_section][channel_index][RF90_PATH_A]); |
---|
1721 | | - } else if (_rtl8812ae_eq_n_byte(pband, (u8 *)("5G"), 2)) { |
---|
| 1710 | + } else if (strcmp(pband, "5G") == 0) { |
---|
1722 | 1711 | ret = _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt(hw, |
---|
1723 | 1712 | BAND_ON_5G, |
---|
1724 | 1713 | channel); |
---|
.. | .. |
---|
1749 | 1738 | } |
---|
1750 | 1739 | |
---|
1751 | 1740 | static void _rtl8812ae_phy_config_bb_txpwr_lmt(struct ieee80211_hw *hw, |
---|
1752 | | - u8 *regulation, u8 *band, |
---|
1753 | | - u8 *bandwidth, u8 *rate_section, |
---|
1754 | | - u8 *rf_path, u8 *channel, |
---|
1755 | | - u8 *power_limit) |
---|
| 1741 | + const char *regulation, const char *band, |
---|
| 1742 | + const char *bandwidth, const char *rate_section, |
---|
| 1743 | + const char *rf_path, const char *channel, |
---|
| 1744 | + const char *power_limit) |
---|
1756 | 1745 | { |
---|
1757 | 1746 | _rtl8812ae_phy_set_txpower_limit(hw, regulation, band, bandwidth, |
---|
1758 | 1747 | rate_section, rf_path, channel, |
---|
.. | .. |
---|
1765 | 1754 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
---|
1766 | 1755 | u32 i = 0; |
---|
1767 | 1756 | u32 array_len; |
---|
1768 | | - u8 **array; |
---|
| 1757 | + const char **array; |
---|
1769 | 1758 | |
---|
1770 | 1759 | if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { |
---|
1771 | 1760 | array_len = RTL8812AE_TXPWR_LMT_ARRAY_LEN; |
---|
.. | .. |
---|
1778 | 1767 | rtl_dbg(rtlpriv, COMP_INIT, DBG_TRACE, "\n"); |
---|
1779 | 1768 | |
---|
1780 | 1769 | for (i = 0; i < array_len; i += 7) { |
---|
1781 | | - u8 *regulation = array[i]; |
---|
1782 | | - u8 *band = array[i+1]; |
---|
1783 | | - u8 *bandwidth = array[i+2]; |
---|
1784 | | - u8 *rate = array[i+3]; |
---|
1785 | | - u8 *rf_path = array[i+4]; |
---|
1786 | | - u8 *chnl = array[i+5]; |
---|
1787 | | - u8 *val = array[i+6]; |
---|
| 1770 | + const char *regulation = array[i]; |
---|
| 1771 | + const char *band = array[i+1]; |
---|
| 1772 | + const char *bandwidth = array[i+2]; |
---|
| 1773 | + const char *rate = array[i+3]; |
---|
| 1774 | + const char *rf_path = array[i+4]; |
---|
| 1775 | + const char *chnl = array[i+5]; |
---|
| 1776 | + const char *val = array[i+6]; |
---|
1788 | 1777 | |
---|
1789 | 1778 | _rtl8812ae_phy_config_bb_txpwr_lmt(hw, regulation, band, |
---|
1790 | 1779 | bandwidth, rate, rf_path, |
---|