* [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment
@ 2019-06-22 0:17 Sriram R
2019-06-22 0:17 ` [PATCH 2/4] ath11k: modify code styling for boolean function return values Sriram R
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Sriram R @ 2019-06-22 0:17 UTC (permalink / raw)
To: ath11k; +Cc: Sriram R
Cleanup the use of REG_RULE struct initializer macro for updating or
addinig reg rules at runtime. Rather make use of a separate function
to update reg rules while building new regd data.
Signed-off-by: Sriram R <srirrama@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/reg.c | 64 +++++++++++++++++++----------------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index cc847a7..f181061 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -468,6 +468,19 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 end_freq, u16 max_bw)
}
static void
+ath11k_reg_update_rule(struct ieee80211_reg_rule *reg_rule, u32 start_freq,
+ u32 end_freq, u32 bw, u32 ant_gain, u32 reg_pwr,
+ u32 reg_flags)
+{
+ reg_rule->freq_range.start_freq_khz = MHZ_TO_KHZ(start_freq);
+ reg_rule->freq_range.end_freq_khz = MHZ_TO_KHZ(end_freq);
+ reg_rule->freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw);
+ reg_rule->power_rule.max_antenna_gain = DBI_TO_MBI(ant_gain);
+ reg_rule->power_rule.max_eirp = DBM_TO_MBM(reg_pwr);
+ reg_rule->flags = reg_flags;
+}
+
+static void
ath11k_reg_update_weather_radar_band(struct ath11k_base *ab,
struct ieee80211_regdomain *regd,
struct cur_reg_rule *reg_rule,
@@ -482,13 +495,10 @@ ath11k_reg_update_weather_radar_band(struct ath11k_base *ab,
bw = ath11k_reg_adjust_bw(reg_rule->start_freq,
ETSI_WEATHER_RADAR_BAND_LOW, max_bw);
- regd->reg_rules[i] = (struct ieee80211_reg_rule)
- REG_RULE(reg_rule->start_freq,
- ETSI_WEATHER_RADAR_BAND_LOW,
- bw,
- reg_rule->ant_gain,
- reg_rule->reg_power,
- flags);
+ ath11k_reg_update_rule(regd->reg_rules + i, reg_rule->start_freq,
+ ETSI_WEATHER_RADAR_BAND_LOW, bw,
+ reg_rule->ant_gain, reg_rule->reg_power,
+ flags);
ath11k_dbg(ab, ATH11K_DBG_REG,
"\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
@@ -505,13 +515,12 @@ ath11k_reg_update_weather_radar_band(struct ath11k_base *ab,
bw = ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_LOW, end_freq,
max_bw);
- regd->reg_rules[++i] = (struct ieee80211_reg_rule)
- REG_RULE(ETSI_WEATHER_RADAR_BAND_LOW,
- end_freq,
- bw,
- reg_rule->ant_gain,
- reg_rule->reg_power,
- flags);
+ i++;
+
+ ath11k_reg_update_rule(regd->reg_rules + i,
+ ETSI_WEATHER_RADAR_BAND_LOW, end_freq, bw,
+ reg_rule->ant_gain, reg_rule->reg_power,
+ flags);
regd->reg_rules[i].dfs_cac_ms = ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT;
@@ -531,14 +540,12 @@ ath11k_reg_update_weather_radar_band(struct ath11k_base *ab,
bw = ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_HIGH,
reg_rule->end_freq, max_bw);
- regd->reg_rules[++i] =
- (struct ieee80211_reg_rule)
- REG_RULE(ETSI_WEATHER_RADAR_BAND_HIGH,
- reg_rule->end_freq,
- bw,
- reg_rule->ant_gain,
- reg_rule->reg_power,
- flags);
+ i++;
+
+ ath11k_reg_update_rule(regd->reg_rules + i, ETSI_WEATHER_RADAR_BAND_HIGH,
+ reg_rule->end_freq, bw,
+ reg_rule->ant_gain, reg_rule->reg_power,
+ flags);
ath11k_dbg(ab, ATH11K_DBG_REG,
"\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
@@ -616,14 +623,11 @@ ath11k_reg_build_regd(struct ath11k_base *ab,
flags |= ath11k_map_fw_reg_flags(reg_rule->flags);
- tmp_regd->reg_rules[i] =
- (struct ieee80211_reg_rule)
- REG_RULE(reg_rule->start_freq,
- reg_rule->end_freq,
- max_bw,
- reg_rule->ant_gain,
- reg_rule->reg_power,
- flags);
+ ath11k_reg_update_rule(tmp_regd->reg_rules + i,
+ reg_rule->start_freq,
+ reg_rule->end_freq, max_bw,
+ reg_rule->ant_gain, reg_rule->reg_power,
+ flags);
/* Update dfs cac timeout if the dfs domain is ETSI and the
* new rule covers weather radar band.
--
2.7.4
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] ath11k: modify code styling for boolean function return values
2019-06-22 0:17 [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment Sriram R
@ 2019-06-22 0:17 ` Sriram R
2019-06-22 0:17 ` [PATCH 3/4] ath11k: replace locally defined MACRO's with actual functions Sriram R
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sriram R @ 2019-06-22 0:17 UTC (permalink / raw)
To: ath11k; +Cc: Sriram R
Modify code styling for boolean function return values by directly
comparing memcmp() result with 0.
Signed-off-by: Sriram R <srirrama@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/reg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index f181061..1b1dd88 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -38,7 +38,7 @@ static bool ath11k_regdom_changes(struct ath11k *ar, char *alpha2)
if (!regd)
return true;
- return !!(memcmp(regd->alpha2, alpha2, 2));
+ return memcmp(regd->alpha2, alpha2, 2) != 0;
}
static void
--
2.7.4
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] ath11k: replace locally defined MACRO's with actual functions
2019-06-22 0:17 [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment Sriram R
2019-06-22 0:17 ` [PATCH 2/4] ath11k: modify code styling for boolean function return values Sriram R
@ 2019-06-22 0:17 ` Sriram R
2019-06-22 0:17 ` [PATCH 4/4] ath11k: Remove stray character in reg notifier debug log Sriram R
2019-06-24 10:51 ` [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment Kalle Valo
3 siblings, 0 replies; 5+ messages in thread
From: Sriram R @ 2019-06-22 0:17 UTC (permalink / raw)
To: ath11k; +Cc: Sriram R
Replace use of locally defined MIN/MAX macros with actual
min_t/max_t functions respectively.
Signed-off-by: Sriram R <srirrama@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/reg.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index 1b1dd88..da8c6c2 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -339,9 +339,6 @@ static void ath11k_reg_intersect_rules(struct ieee80211_reg_rule *rule1,
struct ieee80211_reg_rule *rule2,
struct ieee80211_reg_rule *new_rule)
{
- #define MAX(a, b) max_t(u32, a, b)
- #define MIN(a, b) min_t(u32, a, b)
-
u32 start_freq1, end_freq1;
u32 start_freq2, end_freq2;
u32 freq_diff, max_bw;
@@ -352,30 +349,29 @@ static void ath11k_reg_intersect_rules(struct ieee80211_reg_rule *rule1,
end_freq1 = rule1->freq_range.end_freq_khz;
end_freq2 = rule2->freq_range.end_freq_khz;
- new_rule->freq_range.start_freq_khz = MAX(start_freq1, start_freq2);
- new_rule->freq_range.end_freq_khz = MIN(end_freq1, end_freq2);
+ new_rule->freq_range.start_freq_khz = max_t(u32, start_freq1,
+ start_freq2);
+ new_rule->freq_range.end_freq_khz = min_t(u32, end_freq1, end_freq2);
freq_diff = new_rule->freq_range.end_freq_khz -
new_rule->freq_range.start_freq_khz;
- max_bw = MIN(rule1->freq_range.max_bandwidth_khz,
- rule2->freq_range.max_bandwidth_khz);
- new_rule->freq_range.max_bandwidth_khz = MIN(max_bw, freq_diff);
+ max_bw = min_t(u32, rule1->freq_range.max_bandwidth_khz,
+ rule2->freq_range.max_bandwidth_khz);
+ new_rule->freq_range.max_bandwidth_khz = min_t(u32, max_bw, freq_diff);
new_rule->power_rule.max_antenna_gain =
- MIN(rule1->power_rule.max_antenna_gain,
- rule2->power_rule.max_antenna_gain);
+ min_t(u32, rule1->power_rule.max_antenna_gain,
+ rule2->power_rule.max_antenna_gain);
- new_rule->power_rule.max_eirp = MIN(rule1->power_rule.max_eirp,
- rule2->power_rule.max_eirp);
+ new_rule->power_rule.max_eirp = min_t(u32, rule1->power_rule.max_eirp,
+ rule2->power_rule.max_eirp);
/* Use the flags of both the rules */
new_rule->flags = rule1->flags | rule2->flags;
/* To be safe, lts use the max cac timeout of both rules */
- new_rule->dfs_cac_ms = MAX(rule1->dfs_cac_ms, rule2->dfs_cac_ms);
-
- #undef MAX
- #undef MIN
+ new_rule->dfs_cac_ms = max_t(u32, rule1->dfs_cac_ms,
+ rule2->dfs_cac_ms);
}
static struct ieee80211_regdomain *
--
2.7.4
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] ath11k: Remove stray character in reg notifier debug log
2019-06-22 0:17 [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment Sriram R
2019-06-22 0:17 ` [PATCH 2/4] ath11k: modify code styling for boolean function return values Sriram R
2019-06-22 0:17 ` [PATCH 3/4] ath11k: replace locally defined MACRO's with actual functions Sriram R
@ 2019-06-22 0:17 ` Sriram R
2019-06-24 10:51 ` [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment Kalle Valo
3 siblings, 0 replies; 5+ messages in thread
From: Sriram R @ 2019-06-22 0:17 UTC (permalink / raw)
To: ath11k; +Cc: Sriram R
Remove stray character 'n' used in debug message of
ath11k_reg_notifier()
Signed-off-by: Sriram R <srirrama@codeaurora.org>
---
drivers/net/wireless/ath/ath11k/reg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index da8c6c2..f72b81f 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -50,7 +50,7 @@ ath11k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
int ret;
ath11k_dbg(ar->ab, ATH11K_DBG_REG,
- "Regulatory Notification received for %s n", wiphy_name(wiphy));
+ "Regulatory Notification received for %s\n", wiphy_name(wiphy));
/* Currently supporting only General User Hints. Cell base user
* hints to be handled later.
--
2.7.4
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment
2019-06-22 0:17 [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment Sriram R
` (2 preceding siblings ...)
2019-06-22 0:17 ` [PATCH 4/4] ath11k: Remove stray character in reg notifier debug log Sriram R
@ 2019-06-24 10:51 ` Kalle Valo
3 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2019-06-24 10:51 UTC (permalink / raw)
To: Sriram R; +Cc: ath11k
Sriram R <srirrama@codeaurora.org> wrote:
> Cleanup the use of REG_RULE struct initializer macro for updating or
> addinig reg rules at runtime. Rather make use of a separate function
> to update reg rules while building new regd data.
>
> Signed-off-by: Sriram R <srirrama@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
4 patches applied to ath11k-bringup branch of ath.git, thanks.
596d308e33da ath11k: Avoid use of struct initializers for runtime assignment
a8bfc3648ccd ath11k: modify code styling for boolean function return values
61b7f587e157 ath11k: replace locally defined MACRO's with actual functions
051ebababfc1 ath11k: Remove stray character in reg notifier debug log
--
https://patchwork.kernel.org/patch/11011077/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-06-24 10:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-22 0:17 [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment Sriram R
2019-06-22 0:17 ` [PATCH 2/4] ath11k: modify code styling for boolean function return values Sriram R
2019-06-22 0:17 ` [PATCH 3/4] ath11k: replace locally defined MACRO's with actual functions Sriram R
2019-06-22 0:17 ` [PATCH 4/4] ath11k: Remove stray character in reg notifier debug log Sriram R
2019-06-24 10:51 ` [PATCH 1/4] ath11k: Avoid use of struct initializers for runtime assignment Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox