Commit 3457f86d authored by Brian Norris's avatar Brian Norris Committed by Kalle Valo

rtw88: use txpwr_lmt_cfg_pair struct, not arrays

We're just trusting that these tables are of the right dimensions, when
we could do better by just using the struct directly. Let's expose the
struct txpwr_lmt_cfg_pair instead.

The table changes were made by using some Vim macros, so that should
help prevent any translation mistakes along the way.

Remaining work: get the 'void *data' out of the generic struct
rtw_table; all of these tables really deserve to be their own data
structure, with proper type fields.
Signed-off-by: default avatarBrian Norris <briannorris@chromium.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 15e830e9
...@@ -29,15 +29,6 @@ struct phy_pg_cfg_pair { ...@@ -29,15 +29,6 @@ struct phy_pg_cfg_pair {
u32 data; u32 data;
}; };
struct txpwr_lmt_cfg_pair {
u8 regd;
u8 band;
u8 bw;
u8 rs;
u8 ch;
s8 txpwr_lmt;
};
static const u32 db_invert_table[12][8] = { static const u32 db_invert_table[12][8] = {
{10, 13, 16, 20, {10, 13, 16, 20,
25, 32, 40, 50}, 25, 32, 40, 50},
...@@ -1267,10 +1258,8 @@ static void rtw_xref_txpwr_lmt(struct rtw_dev *rtwdev) ...@@ -1267,10 +1258,8 @@ static void rtw_xref_txpwr_lmt(struct rtw_dev *rtwdev)
void rtw_parse_tbl_txpwr_lmt(struct rtw_dev *rtwdev, void rtw_parse_tbl_txpwr_lmt(struct rtw_dev *rtwdev,
const struct rtw_table *tbl) const struct rtw_table *tbl)
{ {
const struct txpwr_lmt_cfg_pair *p = tbl->data; const struct rtw_txpwr_lmt_cfg_pair *p = tbl->data;
const struct txpwr_lmt_cfg_pair *end = p + tbl->size / 6; const struct rtw_txpwr_lmt_cfg_pair *end = p + tbl->size;
BUILD_BUG_ON(sizeof(struct txpwr_lmt_cfg_pair) != sizeof(u8) * 6);
for (; p < end; p++) { for (; p < end; p++) {
rtw_phy_set_tx_power_limit(rtwdev, p->regd, p->band, rtw_phy_set_tx_power_limit(rtwdev, p->regd, p->band,
......
...@@ -45,6 +45,15 @@ void rtw_phy_set_tx_power_level(struct rtw_dev *rtwdev, u8 channel); ...@@ -45,6 +45,15 @@ void rtw_phy_set_tx_power_level(struct rtw_dev *rtwdev, u8 channel);
void rtw_phy_tx_power_by_rate_config(struct rtw_hal *hal); void rtw_phy_tx_power_by_rate_config(struct rtw_hal *hal);
void rtw_phy_tx_power_limit_config(struct rtw_hal *hal); void rtw_phy_tx_power_limit_config(struct rtw_hal *hal);
struct rtw_txpwr_lmt_cfg_pair {
u8 regd;
u8 band;
u8 bw;
u8 rs;
u8 ch;
s8 txpwr_lmt;
};
#define RTW_DECL_TABLE_PHY_COND_CORE(name, cfg, path) \ #define RTW_DECL_TABLE_PHY_COND_CORE(name, cfg, path) \
const struct rtw_table name ## _tbl = { \ const struct rtw_table name ## _tbl = { \
.data = name, \ .data = name, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment