Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -29,15 +29,6 @@ struct phy_pg_cfg_pair {
	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] = {
	{10,		13,		16,		20,
	 25,		32,		40,		50},
@@ -1267,10 +1258,8 @@ static void rtw_xref_txpwr_lmt(struct rtw_dev *rtwdev)
void rtw_parse_tbl_txpwr_lmt(struct rtw_dev *rtwdev,
			     const struct rtw_table *tbl)
{
	const struct txpwr_lmt_cfg_pair *p = tbl->data;
	const struct txpwr_lmt_cfg_pair *end = p + tbl->size / 6;

	BUILD_BUG_ON(sizeof(struct txpwr_lmt_cfg_pair) != sizeof(u8) * 6);
	const struct rtw_txpwr_lmt_cfg_pair *p = tbl->data;
	const struct rtw_txpwr_lmt_cfg_pair *end = p + tbl->size;

	for (; p < end; p++) {
		rtw_phy_set_tx_power_limit(rtwdev, p->regd, p->band,
+9 −0
Original line number Diff line number Diff line
@@ -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_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)	\
const struct rtw_table name ## _tbl = {			\
	.data = name,					\
+1172 −392

File changed.

Preview size limit exceeded, changes collapsed.

+1756 −879

File changed.

Preview size limit exceeded, changes collapsed.